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 8358 Articles
AmitDiwan
322 Views
To list all variables initialized by SET operator, the syntax is as follows −select * from performance_schema.user_variables_by_thread;Here is the query to set the variable −mysql> set @FirstName='John'; Query OK, 0 rows affected (0.00 sec) mysql> set @LastName='Doe'; Query OK, 0 rows affected (0.00 sec)Here is the query to display the ... Read More
AmitDiwan
589 Views
For this, use date_add() with interval command. Let us first create a table −mysql> create table DemoTable1867 ( ArrivalTime datetime ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1867 values('2019-10-12 12:34:45'); Query OK, ... Read More
AmitDiwan
322 Views
For this, use FIND_IN_SET(). Let us first create a table −mysql> create table DemoTable1866 ( Value1 int, ListOfValues varchar(100) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1866 values(56, '78, 56, ... Read More
AmitDiwan
1K+ Views
Use @anyVariableName to assign the result of a query into a variable. Let us first create a table −mysql> create table DemoTable1864 ( Id int, FirstName varchar(20), LastName varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in ... Read More
AmitDiwan
765 Views
To set default value for empty row, use the concept of COALESCE(). Let us first create a table −mysql> create table DemoTable1863 ( FirstName varchar(20) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into ... Read More
AmitDiwan
252 Views
For this, use the concept of GREATEST(). Let us first create a table −mysql> create table DemoTable1862 ( Value1 int, Value2 int, Value3 int, Value4 int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the ... Read More
AmitDiwan
490 Views
For this, you can use GROUP BY HAVING with subquery. Let us first create a table −mysql> create table DemoTable1861 ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Name varchar(20), Marks int ); Query OK, 0 rows affected (0.00 sec)Insert ... Read More
AmitDiwan
593 Views
For this, you can use SELECT INTO. Let us first create a table −mysql> create table DemoTable1860 ( Amount int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1860 values(1590); Query OK, 1 ... Read More
AmitDiwan
248 Views
Yes, use the ALTER command with RENAME. Let us first create a table −mysql> create table DemoTable1859 ( Id int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1859 values(101); Query OK, 1 ... Read More
AmitDiwan
710 Views
For this, use GROUP BY HAVING clause. Let us first create a table −mysql> create table DemoTable1858 ( ModelNumber varchar(50) ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1858 values('Audi A4'); Query OK, ... Read More