
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
3K+ Views
For the current date, use CURDATE(). Also, use STR_TO_DATE() to format date and compare it with the current date as in the below syntax −Syntaxselect *from yourTableName where str_to_date(yourColumnName, 'yourFormatSpecifier')=curdate();Let’s say the current date is 27/10/2019.Let us first create a table −mysql> create table DemoTable -> ( -> ... Read More

AmitDiwan
630 Views
For this, you can use ORDER BY FIELD. Let us first create a table −mysql> create table DemoTable -> ( -> Id int, -> Name varchar(20) -> ); Query OK, 0 rows affected (1.78 sec)Insert some records in the table using insert command −mysql> insert into ... Read More

AmitDiwan
540 Views
For this, use UNION more than once in a single MySQL query. Let us first create a table −mysql> create table DemoTable -> ( -> Value1 int, -> Value2 int, -> Value3 int -> ); Query OK, 0 rows affected (0.69 sec)Insert some records in ... Read More

AmitDiwan
216 Views
CASE statement with the WHEN clause is used to work around conditions. Following is the syntax−select *, case when yourCondition then yourStatement when yourCondition then yourStatement . . else yourStatement from yourTableName;Let us first create a table −mysql> create table DemoTable -> ( -> ... Read More

AmitDiwan
107 Views
To replace duplicate records and avoid any error while inserting, use INSERT ON DUPLICATE KEY UPDATE. Let us first create a table −mysql> create table DemoTable -> ( -> Id int, -> Name varchar(20), -> UNIQUE(Id, Name) -> ); Query OK, 0 rows affected (0.78 ... Read More

AmitDiwan
3K+ Views
Yes, we can turn a column records into a list using the MySQL GROUP_CONCAT(). Let us first create a table −mysql> create table DemoTable -> ( -> ClientId int, -> ClientName varchar(20) -> ); Query OK, 0 rows affected (0.88 sec)Insert some records in the table ... Read More

AmitDiwan
704 Views
To create a temporary table with dates, use the CREATE TEMPORARY TABLE in MySQL. Following is the syntax −Syntaxcreate temporary table yourTableName( yourColumnName datetime );Let us first create a table −mysql> create temporary table DemoTable -> ( -> DueDate datetime -> ); Query OK, 0 rows ... Read More

AmitDiwan
857 Views
To increase item value for multiple items in a single query, you can use the CASE statement in MySQL. Let us first create a table −mysql> create table DemoTable -> ( -> ProductName varchar(20), -> ProductPrice int -> ); Query OK, 0 rows affected (0.51 sec)Insert ... Read More

AmitDiwan
2K+ Views
For this, you can use GROUP BY HAVING along with the COUNT(*) function. Let us first create a table −mysql> create table DemoTable -> ( -> Value int -> ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert ... Read More

AmitDiwan
454 Views
It would be good to use IN() instead of multiple OR statements. 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.83 sec)Insert some records ... Read More