Category Archive : MySQL

A sub-query is a SQL query that is used inside another query.

There is no specific pattern for sub-query. Sub-query is used when need to query from another or multiple tables and show data.

Suppose, you have to query with … Read more

The GROUP BY statement is used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result set by one or more columns.

Pattern:

SELECT column_name FROM table_name GROUP BY column_name;
or
SELECT column_name1,column_name2 FROM table_name GROUP BY column_name1,column_name2;
Read more

If you want to sort data, then you have to use order by clause. If you want to sort data in ascending order, then you have to use the following query:

Pattern:

select * from table_name order by column_name ASC;
Read more

Insert Data

Now we will add some data using the SQL insert query

Insert query pattern:

insert into table_name (column1,column2,column3,……..columnN) values (‘value1′,’value2′,’value3′,……….,’valueN’);

Now insert some data into our newly created table using this query:

INSERT INTO employees (Emp_id,FirstName,LastName,Department,Designation,Salary) VALUES ('1001','Abdur', 
Read more

SQL commands are 4 types. DDL, DML, DCL and TCL

Here I am describing about the SQL Commands.

DDL

DDL is the short name of Data Definition Language. It used to create, update, and delete database schemas and their … Read more