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 10740 Articles
AmitDiwan
372 Views
To subtract a day in MySQL, use the DATE_SUB() method. Let us first create a table −mysql> create table DemoTable -> ( -> AdmissionDate timestamp -> ); Query OK, 0 rows affected (1.05 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-01-01'); ... Read More
AmitDiwan
392 Views
No, we cannot. To still work it out, use backticks around the field name. Let us first create a table with column name with asterisk, `Name*` −mysql> create table DemoTable -> ( -> `Name*` varchar(20) -> ); Query OK, 0 rows affected (2.03 sec)Insert some records in ... Read More
AmitDiwan
157 Views
For this, you can use SOUND along with the LIKE operator. Let us first create a table −mysql> create table DemoTable -> ( -> Name varchar(20) -> ); Query OK, 0 rows affected (0.95 sec)Insert some records in the table using insert command −mysql> insert into DemoTable ... Read More
AmitDiwan
750 Views
To replace a record that doesn’t exist, use the COALESCE in MySQL. The COALESCE would help in substituting the NULL values. Let us first create a table −mysql> create table DemoTable -> ( -> Code varchar(20) -> ); Query OK, 0 rows affected (1.64 sec)Insert some records ... Read More
AmitDiwan
222 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Id int, -> Name varchar(20) -> ); Query OK, 0 rows affected (0.82 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(201, 'Chris Brown'); Query OK, 1 row ... Read More
AmitDiwan
158 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Value1 int, -> Value2 int -> ); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(78, 89); Query OK, 1 row affected ... Read More
AmitDiwan
504 Views
For this, you can use CASE WHEN statement. Let us first create a table −mysql> create table DemoTable -> ( -> FirstName varchar(20), -> Score int -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> ... Read More
AmitDiwan
192 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> FirstName varchar(20) -> ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(FirstName) values('Chris'); Query ... Read More
AmitDiwan
439 Views
To find the difference between two datetime values, you can use TIMESTAMPDIFF(). Let us first create a table −mysql> create table DemoTable -> ( -> DueDatetime1 datetime, -> DueDatetime2 datetime -> ); Query OK, 0 rows affected (0.86 sec)Insert some records in the table using insert ... Read More
AmitDiwan
190 Views
Let us first create a table −mysql> create table DemoTable -> ( -> DueDate date ->); Query OK, 0 rows affected (2.11 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-01-21'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable ... Read More