
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
112 Views
For this, you can use ORDER BY RAND() with LIMIT. Let us first create a −mysql> create table DemoTable1426 -> ( -> FirstName varchar(20) -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert −mysql> insert into DemoTable1426 values('John'); Query OK, ... Read More

AmitDiwan
180 Views
Yes, you can use aggregate function COUNT(*) along with GROUP BY clause. Let us first create a −mysql> create table DemoTable1425 -> ( -> JoiningYear int -> ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert −mysql> insert into DemoTable1425 values(2000); ... Read More

AmitDiwan
342 Views
For this, use CONCAT() along with SUBSTRING_INDEX(). Let us first create a −mysql> create table DemoTable1424 -> ( -> Value varchar(60) -> ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert −mysql> insert into DemoTable1424 values('567.78483733'); Query OK, 1 row affected ... Read More

AmitDiwan
2K+ Views
Use FIND_IN_SET() instead of MySQL IN(). Let us first create a −mysql> create table DemoTable1423 -> ( -> CountryName varchar(100) -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert −mysql> insert into DemoTable1423 values('AUS, UK'); Query OK, 1 row affected ... Read More

AmitDiwan
699 Views
To select all data between range of two dates, use MySQL BETWEEN −select * from yourTableName where yourColumnName between yourDateValue1 and yourDateValue2;Let us first create a −mysql> create table DemoTable1422 -> ( -> EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> EmployeeName varchar(20), -> EmployeeJoiningDate date ... Read More

AmitDiwan
814 Views
To set conditions, use MySQL CASE statement. Let us first create a −mysql> create table DemoTable1481 -> ( -> PlayerScore int -> ); Query OK, 0 rows affected (0.42 sec)Insert some records in the table using insert −mysql> insert into DemoTable1481 values(454); Query OK, 1 row affected ... Read More

AmitDiwan
235 Views
Yes, we can fetch, but use MySQL OR for conditions. Let us first create a −mysql> create table DemoTable1421 -> ( -> EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> EmployeeName varchar(20), -> EmployeeSalary int -> ); Query OK, 0 rows affected (0.82 sec)Insert some ... Read More

AmitDiwan
926 Views
For this, you can use MySQL IN(). Let us first create a −mysql> create table DemoTable1420 -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> FirstName varchar(20), -> LastName varchar(20), -> Age int -> ); Query OK, 0 rows affected (1.12 sec)Insert ... Read More

AmitDiwan
945 Views
To convert, use MySQL TIME_FORMAT(). Let us first create a −mysql> create table DemoTable1419 -> ( -> ArrivalTime time -> ); Query OK, 0 rows affected (0.78 sec)Insert some records in the table using insert command. Here, we have inserted time records −mysql> insert into DemoTable1419 values('12:30:45'); ... Read More

AmitDiwan
103 Views
Let us first create a −mysql> create table DemoTable1418 -> ( -> EmployeeCode text -> ); Query OK, 0 rows affected (0.51 sec)Insert some records in the table using insert −mysql> insert into DemoTable1418 values('EMP-2110/Carol'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable1418 values('EMP-1900/David'); ... Read More