
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
1K+ Views
To avoid using the BETWEEN clause, you can use the AND to fetch the values between a range. Let us first create a table −mysql> create table DemoTable ( Number int ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert ... Read More

AmitDiwan
19K+ Views
To fetch the first alphabet from the strings, use LEFT(). This method allows you to return characters from the left of the string.Let us first see an example and create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, FirstName varchar(100) ); Query ... Read More

AmitDiwan
288 Views
To change the column name, use the AS keyword after the column name. Let us first create a table −mysql> create table DemoTable ( Id int, StudentFirstNameInCollege varchar(100) ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable ... Read More

AmitDiwan
831 Views
For this, you can use the ORDER BY clause. Let us first create a table −mysql> create table DemoTable ( Name varchar(40), Score int ); Query OK, 0 rows affected (1.11 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris', 45); Query OK, ... Read More

AmitDiwan
156 Views
You can use REPLACE INTO that works like DELETE + INSERT. Let us first create a table −mysql> create table DemoTable ( Id int, FirstName varchar(50) ); Query OK, 0 rows affected (0.60 sec)Following is the query to create a unique index −mysql> alter table DemoTable add unique ... Read More

AmitDiwan
182 Views
To find the highest and lowest from two tables, use MAX() and MIN(). Since the results are to be displayed from two tables, you need to use UNION. Let us first create a table −mysql> create table DemoTable1 ( UniqueId int NOT NULL AUTO_INCREMENT PRIMARY KEY, Score1 int ... Read More

AmitDiwan
761 Views
If your first column is AUTO_INCREMENT, then you can skip the column and place the value NULL. Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentFirstName varchar(100), StudentAge int ); Query OK, 0 rows affected (0.60 sec)Insert ... Read More

AmitDiwan
90 Views
To optimize many SELECTs, use it once and apply IN() to fetch multiple values. Let us first create a table −mysql> create table DemoTable ( Id int, Name varchar(100), Age int ); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command ... Read More

AmitDiwan
975 Views
To count the duplicate ID values, use aggregate function COUNT() and GROUP BY. Let us first create a table −mysql> create table DemoTable ( Id int, Name varchar(100) ); Query OK, 0 rows affected (1.30 sec)Insert some records in the table using insert command −mysql> insert into DemoTable ... Read More

AmitDiwan
511 Views
Let us first create a table −mysql> create table DemoTable1 ( Id int, Name varchar(100) ); Query OK, 0 rows affected (0.86 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(1001, 'Chris'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1 ... Read More