
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
132 Views
Let us first create a table −mysql> create table DemoTable1897 ( Name varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1897 values('john'); Query OK, 1 row affected (0.00 sec) mysql> insert into DemoTable1897 values('Chris'); Query ... Read More

AmitDiwan
2K+ Views
For this, use SELECT INTO variable with where clause. Let us first create a table −mysql> create table DemoTable1896 ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(20), StudentMarks int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using ... Read More

AmitDiwan
399 Views
Define with NOT NULL, if a column must not be empty. Let us first create a table with one of the columns as NOT NULL −mysql> create table DemoTable1895 ( Id int NOT NULL, FirstName varchar(20), LastName varchar(20) NOT NULL ); Query OK, 0 rows ... Read More

AmitDiwan
578 Views
For this, use unix_timestamp(). Let us first create a table −mysql> create table DemoTable1894 ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, DueTime int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1894 values(); Query ... Read More

AmitDiwan
169 Views
Yes, we can do regex match in a select statement −select yourColumnName from yourTableName where yourColumnName regexp '^yourValue';Let us first create a table −mysql> create table DemoTable1892 ( FirstName varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> ... Read More

AmitDiwan
909 Views
Let us first create a stored procedure −mysql> delimiter // mysql> create procedure declare_demo_sp() begin declare Value1 int; declare Value2 int; set Value1=100; set Value2=2000; select Value1, Value2, Value1*Value2 as MultiplicationResult; end // Query OK, 0 rows affected (0.00 sec) mysql> delimiter ... Read More

AmitDiwan
246 Views
For this, use INSERT ON DUPLICATE KEY UPDATE command. Let us first create a table −mysql> create table DemoTable1891 ( FirstName varchar(20), UNIQUE KEY(FirstName) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1891 values('Chris') on ... Read More

AmitDiwan
394 Views
For this, use IF(). Let us first see the current date −mysql> select curdate(); +------------+ | curdate() | +------------+ | 2019-12-10 | +------------+ 1 row in set (0.00 sec)Let us first create a table −mysql> create table DemoTable1890 ( DueDate timestamp ); Query OK, 0 rows affected ... Read More

AmitDiwan
968 Views
To sum current month records, use the SUM() and MONTH() function. Let us first create a table −mysql> create table DemoTable1889 ( DueDate date, Amount int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1889 ... Read More

AmitDiwan
874 Views
For this, you can use MD5(). Let us first create a table −mysql> create table DemoTable1887 ( Password text, HashPassword text ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1887(Password) values('John@9089'); Query OK, 1 row ... Read More