How can I get the information about a particular column of a table by MySQL DESCRIBE statement?

Published on 21-Feb-2018 17:23:03
As we know that DESCRIBE statement will provide the information/structure of the whole table. With the help of DESCRIBE statement along with table name and the column name, we can get the information about that column.SyntaxDESCRIBE table_name col_name;Example1mysql> Describe employee ID; +-------+---------+------+-----+---------+----------------+ | Field | Type    | Null | ... Read More

What kind of information is displayed by MySQL DESCRIBE statement?

Published on 21-Feb-2018 17:18:57
The DESCRIBE statement gives information about MySQL table’s structure.ExampleConsider the constructing of the following table name ‘Employee’ with Create Table statement as follows −mysql> Create table Employee(ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, Name Varchar(20)); Query OK, 0 rows affected (0.20 sec)Now with the help of ‘DESCRIBE Employee‘ statement, we ... Read More

How can I change the default sort order of MySQL tables?

Giri Raju
Published on 21-Feb-2018 17:15:56
As we know that when we use ORDER BY Clause, the default sort order of MySQL table is ascending, start with the smallest value. We can change this default order by using DESC keyword along with ORDER BY Clause. The following example will clarify this concept −>mysql> Select * from ... Read More

What is the default sort order in MySQL tables?

Rishi Rathor
Published on 21-Feb-2018 17:22:08
The default sort order in MySQL tables is ascending. Whenever we use ORDER BY clause to sort out the rows of a table, MySQL gives output in ascending order, with the smallest value first. Consider the following example from a table named ‘student’ −mysql> Select * from student order by ... Read More

How can the rows be sorted out in a meaningful way?

Abhinanda Shri
Published on 21-Feb-2018 17:22:15
For sorting the rows in a meaningful way we can use ORDER BY clause. Suppose we want to sort the rows of the following table −mysql> Select * from Student; +--------+--------+--------+ | Name   | RollNo | Grade  | +--------+--------+--------+ | Gaurav |    100 | | | Aarav ... Read More

How can we combine ROW selection with COLUMN selection in MySQL?

Nancy Den
Published on 21-Feb-2018 17:15:55
For combining ROW selection with COLUMN selection, we can use the ‘WHERE’ clause. For example, we have a table below −mysql> Select * from Student; +--------+--------+--------+ | Name   | RollNo | Grade  | +--------+--------+--------+ | Gaurav | 100    | | | Aarav  | 150    | M.SC ... Read More

What is MySQL LOAD DATA statement?

Ankitha Reddy
Published on 21-Feb-2018 17:17:26
LOAD DATAThis statement is used for importing the data from data files into our database. It reads data records directly from a file and inserts them into a table. Its syntax would be as follows −SyntaxLOAD DATA LOCAL INFILE '[path/][file_name]' INTO TABLE [table_name ];Here, a path is the address of ... Read More

How can we use a MySQL subquery with INSERT statement?

Arjun Thakur
Published on 21-Feb-2018 17:07:54
It can be understood with the help of an example in which we would copy the values of a table into other table. We are using the data from table ‘cars’ and copy its data to table ‘copy_cars’ −mysql> CREATE TABLE copy_cars LIKE cars; Query OK, 0 rows affected (0.86 ... Read More

How do we count the records from MySQL table where column holds duplicate/triplicates data?

Daniol Thomas
Published on 21-Feb-2018 17:12:59
Suppose we have the following table named stock_item in which the column quantity is having duplicate values i.e. for item name ‘Notebooks’ and ‘Pencil’, the column ‘Quantity’ is having duplicate values ‘40’ and for items ‘Shirts’, ‘Shoes’ and ‘Trousers’ triplicate value 29 is hold by column ‘quantity’ as shown in ... Read More

What is the use of EXIST and EXIST NOT operator with MySQL subqueries?

Samual Sam
Published on 21-Feb-2018 17:07:21
The EXIST operator test for the existence of rows in the result set of the subquery. If a subquery row value is found then EXISTS subquery is TRUE and NOT EXISTS subquery if FALSE. To illustrate it we are using the tables ‘Cars’, ‘Customers’ and ‘Reservations’ having the following data ... Read More