
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
Kumar Varma has Published 107 Articles

Kumar Varma
201 Views
For this, you can use LEAST(). Following is the syntax −select least(yourColumnName, yourMaxValue) from yourTableName;Let us first create a table −mysql> create table DemoTable -> ( -> Number int -> ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> ... Read More

Kumar Varma
394 Views
To get age from DOB, you can use the TIMESTAMPDIFF() function. Following is the syntax −select TIMESTAMPDIFF(YEAR, yourColumnName, CURRENT_DATE) AS anyAliasName from yourTableName;Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> DateOfBirth datetime -> ... Read More

Kumar Varma
227 Views
For this, use ORDER BY clause. The current date is as follows −mysql> select now(); +---------------------+ | now() | +---------------------+ | 2019-06-09 21:08:16 | +---------------------+ 1 row in set (0.00 sec)Let us first create a table ... Read More

Kumar Varma
255 Views
To get the current size of a table, use the following that will display details about a table including the size −show table status like ‘yourTableName’\GLet us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> CustomerName ... Read More

Kumar Varma
2K+ Views
To convert time to seconds, use the TIME_TO_SEC() method. Let us first create a table −mysql> create table DemoTable -> ( -> ArrivalTime time -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('04:10:00'); Query ... Read More

Kumar Varma
171 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Name varchar(100) -> ); Query OK, 0 rows affected (0.85 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.17 sec) mysql> insert ... Read More

Kumar Varma
406 Views
Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Name varchar(20) -> ); Query OK, 0 rows affected (0.69 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(Name) values('Carol'); Query ... Read More

Kumar Varma
746 Views
For this, you can use GROUP BY HAVING clause. Let us first create a table −mysql> create table DemoTable -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> Subject varchar(100) -> ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table ... Read More

Kumar Varma
246 Views
Use CASE statement for this. Let us first create a table −mysql> create table DemoTable -> ( -> StudentMarks int, -> isValid tinyint(1) -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(45, 0); ... Read More

Kumar Varma
197 Views
Let us first create a table −mysql> create table DemoTable1 -> ( -> StudentId int, -> StudentName varchar(20) -> ); Query OK, 0 rows affected (0.64 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10, 'John'); Query OK, 1 row affected ... Read More