
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
AmitDiwan has Published 10744 Articles

AmitDiwan
322 Views
Let us first create a table −mysql> create table DemoTable722 ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(100), StudentAge int ); Query OK, 0 rows affected (1.84 sec)Insert some records in the table using insert command −mysql> insert into DemoTable722(StudentName, StudentAge) values('Chris Brown', 23) ; ... Read More

AmitDiwan
155 Views
Yes, SELECT with an IF/ELSE is possible in MySQL.Let us first create a table −mysql> create table DemoTable721 ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, FirstName varchar(100), Marks int, CountryName varchar(100) ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using ... Read More

AmitDiwan
603 Views
Use trigger BEFORE INSERT on the table to prevent having a zero value in a MySQL field. Let us first create a table −mysql> create table DemoTable(Value int); Query OK, 0 rows affected (0.85 sec)Let us create a trigger to prevent having a zero value in a MySQL field −mysql> ... Read More

AmitDiwan
119 Views
At first, to use reserved words, it should be set with backticks like −`from` `to`Since you want to select the column names set with backtick as shown above, you need to implement the following −select `to`, `from` from yourTableName;Let us first create a table with column names as from and ... Read More

AmitDiwan
739 Views
The slash means division ( /) in MySQL query. This can be used to divide two numbers. Here, we will see an example to divide numbers from two columns and display result in a new column.Let us first create a table −mysql> create table DemoTable719 ( FirstNumber int, ... Read More

AmitDiwan
2K+ Views
For this, you can use NOT IN() function.Let us first create a table −mysql> create table DemoTable718 ( Id int, FirstName varchar(100), Age int ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command −mysql> insert into DemoTable718 values(101, 'Chris', 26); ... Read More

AmitDiwan
122 Views
For this, you can use ORDER BY IF(CAST()). Let us first create a table −mysql> create table DemoTable(EmployeeCode varchar(100)); Query OK, 0 rows affected (1.17 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('190'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable ... Read More

AmitDiwan
914 Views
Let us first create a table −mysql> create table DemoTable717 ( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserPassword int ); Query OK, 0 rows affected (0.81 sec)Insert some records in the table using insert command −mysql> insert into DemoTable717(UserPassword) values(1454343); Query OK, 1 row affected (0.21 sec) ... Read More

AmitDiwan
466 Views
Let us first create a table −mysql> create table DemoTable716 ( Id varchar(100), Value1 int, Value2 int, Value3 int ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command −mysql> insert into DemoTable716 values('100', 45, 86, 79); Query OK, 1 ... Read More

AmitDiwan
873 Views
To order by length of column in MySQL, use ORDER BY LENGTH.Let us first create a table −mysql> create table DemoTable715 (UserMessage varchar(100)); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable715 values('Aw'); Query OK, 1 row affected (0.49 sec) ... Read More