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
486 Views
To delete only specific rows, use MySQL NOT IN(). Let us first create a table −mysql> create table DemoTable1830 ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(20) )AUTO_INCREMENT=101; Query OK, 0 rows affected (0.00 sec)Insert some records in the table ... Read More
AmitDiwan
167 Views
Let us first create a table −mysql> create table DemoTable1829 ( Name varchar(20), isTopper ENUM('YES', 'NO') ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1829 values('Chris', 'yes'); Query OK, 1 row ... Read More
AmitDiwan
101 Views
To add a set of elements in a single cell, use the concept of JSON. Let us first create a table −mysql> create table DemoTable1828 ( EmployeeId int, EmployeeRecords JSON ); Query OK, 0 rows affected (0.00 sec)Insert some records in the ... Read More
AmitDiwan
860 Views
Let us create a stored procedure. Here, we are calculating amount*quantity i.e. implementing mathematical operations −mysql> delimiter // mysql> create procedure calculation_proc(amount int, quantity int) begin select amount, quantity, (amount*quantity) as Total; end // Query OK, 0 rows affected (0.00 sec) mysql> ... Read More
AmitDiwan
520 Views
To search for ^ character, use the LIKE operator as in the below syntax −select table_schema, table_name, column_name from information_schema.columns where column_name like '%^%';Let us first create a table −mysql> create table DemoTable1826 ( `^` varchar(20), Name varchar(20), `^Age` int ... Read More
AmitDiwan
558 Views
For this, you can use IS NOT NULL property. Let us first create a table −mysql> create table DemoTable1 ( DueDate date ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values('2019-09-10'); Query ... Read More
AmitDiwan
432 Views
To implement if-else, the syntax is as follows −if yourCondition then yourStatement1; else yourStatement2; end if ;To understand the above concept for if-else in a stored procedure, let us create a stored procedure −mysql> delimiter // mysql> create procedure If_else_stored_demo(value int) ... Read More
AmitDiwan
773 Views
To increase precision with division, use MySQL CAST(). Let us first create a table −mysql> create table DemoTable1823 ( Value int ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1823 values(1); Query OK, ... Read More
AmitDiwan
756 Views
Let us first create a table −mysql> create table DemoTable1822 ( Amount int, DueDate date ); Query OK, 0 rows affected (0.00 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1822 values(1000, '2019-10-11'); Query OK, 1 row affected ... Read More
AmitDiwan
145 Views
No, the query won’t work. Let’s create the same scenario and check the error −mysql> create table DemoTable1821 ( Id int, FirstName varchar, LastName varchar ); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual ... Read More