Select query is used to select data from database table. The syntax is below:
Syntax:- Select column_name from table_name.
Use distinct keyword if you want to return only distinct (not common) values.
Syntax:- select distinct column_name from table_name
Order by clause is used to return result in sorted way. For example:
Select column_name from table_name order by column_name
Inner Join, Left Join, Right Join, Union Join
Return all the rows matching in both the tables.
Return all the rows of first table even if they are not matching with second table.
Return all the rows of second table even if they are not matching with first table.
To display information from two tables with same data type. Union ALL will display duplicate rows of two tables.
Difference between truncate and delete:
Truncate will remove all the data from a table but it will not delete the table itself.
This statement is used to add or drop columns in an existing table.