
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
216 Views
You can detect with the help of row_count(). If the row_count() returns 1 that means it is a new record. If it returns 2, that means the ON UPDATE event is fired with query. Following is the syntax −select row_count();Let us first create a table −mysql> create table DemoTable1512 ... Read More

AmitDiwan
1K+ Views
Fir this, you can use IFNULL() along with ORDER BY clause. Let us first create a table table −mysql> create table DemoTable1511 -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> FirstName varchar(20) -> ); Query OK, 0 rows affected (1.97 sec)Insert some records ... Read More

AmitDiwan
235 Views
Following is the syntax −select length(yourColumnName) - length(replace(yourColumnName, ', ', '')) as anyAliasName from yourTableName;Let us first create a table −mysql> create table DemoTable1510 -> ( -> Value varchar(50) -> ); Query OK, 0 rows affected (6.75 sec)Insert some records in the table using insert command −mysql> ... Read More

AmitDiwan
495 Views
For this, you can use INTERVAL in MySQL. Let us first create a table −mysql> create table DemoTable1509 -> ( -> ArrivalTime datetime -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1509 values('2018-01-21 10:20:30'); Query ... Read More

AmitDiwan
193 Views
Use @ for variable and concat_ws() to display concatenated result in the table. Let us first create a table −mysql> create table DemoTable1508 -> ( -> StudentFirstName varchar(20), -> StudentLastName varchar(20) -> ); Query OK, 0 rows affected (0.55 sec)Insert some records in the table using ... Read More

AmitDiwan
2K+ Views
For this, you can use group_concat(). Let us first create a table −mysql> create table DemoTable1507 -> ( -> Name varchar(20), -> PaperSet int -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1507 values('Chris', ... Read More

AmitDiwan
366 Views
For this, you can use REPLACE(). Let us first create a table −mysql> create table DemoTable1506 -> ( -> Title text -> ); Query OK, 0 rows affected (0.70 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1506 values('This is MySQL'); Query OK, ... Read More

AmitDiwan
273 Views
For this, you can use CASE statement. Let us first create a table −mysql> create table DemoTable1505 -> ( -> Value integer unsigned, -> Status tinyint(1) -> ); Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into ... Read More

AmitDiwan
265 Views
Let us first create a table table −mysql> create table DemoTable1504 -> ( -> Id int, -> FirstName varchar(20) -> ); Query OK, 0 rows affected (0.83 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1504 values(101, 'Chris'); Query OK, 1 row ... Read More

AmitDiwan
859 Views
Yes, we can pass NULL as in the below syntax −insert into yourTableName values(NULL, yourValue1, yourValue2, ...N);Let us first create a table −mysql> create table DemoTable1503 -> ( -> ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> ClientName varchar(20), -> ClientAge int -> ); Query ... Read More