SQL server is the most popular database of microsoft company which was develop in 1989. SQL stands for Structure Query Language. It is RDBMs so in this case record is store in tabular format. It is platform dependent because it runs only on windows operating system.

SQL SELECT UNIQUE

Each Select Statement within UNION must have the same number of columns. The columns in each SELECT statement must also be in the same. The columns must also have similar data types is knows as SQL Select UNIQE

Syntax

SELECT column_name(s) FROM table1

UNION

SELECT column_name(s) FROM table2;

Example of UNION Select Statement

SELECT * FROM person2
UNION
SELECT * FROM person3
Statement

Before output see the this table

input
Input

Output of UNION Select Statement

After output see the this table

Output

 Distinct SELECT SQL

The SQL DISTINCT  is use with SELECT key word to retrieve only unique data is knows as Distict Select SQL.

NOTE: SELECT UNIQUE and SELECT DISTINCT statements are same.

Syntax

SELECT DISTINCT column1, column2

FROM table_name;

Example of Distinct SELECT SQL

SELECT DISTINCT name
FROM person2;
Input

Output of Distinct SELECT SQL

Output

SELECT COUNT Statement in SQL

This function returns the number of records return by a select query is knows as Select Count Statement in SQL

Syntax

SELECT COUNT(column_name) FROM table_name; 

Example of Select Count Statement in SQL

SELECT COUNT(name)
FROM person;

Output of Select Count Statement in SQL

SQL SELECT FIRST

This function is use to return the first value of the selected column is knows as SQL Select FIRST.

Syntax

SELECT FIRST(column_name) FROM table_name; 

Note : This statement is only supporte by MS Access. This statement does not work with other databases just like Oracle, MySQL etc.

SELECT data from Multiple Tables in SQL

Syntax

SELECT tablenmae1.colunmname, tablename2.columnnmae    
FROM tablenmae1  
JOIN tablename2  
ON tablenmae1.colunmnam = tablename2.columnnmae
ORDER BY columnname;

Example of Multiple Table in SQL

SELECT student1.id, student1.First_Name, student2.id, student2.Last_Name,
college4.email, college4.Address, college4.phone
FROM student1
left join student2
on student2.id= student1.id
left join student1
on student1.id= student.phone

SQL SELECT DATE

SELECT DATE is use to get the data from the table relate to the date, the default format of date is ‘YYYY-MM-DD’ is knows as SQL SELECT DATE.

Syntax

SELECT * FROM table_name

WHERE condition1, condition2,..;

Example of Select Date

SELECT * FROM person3
WHERE birth_date ='1990-10-21';

Output of select date

If you have any queries regarding this article or if I have missed something on this topic, please feel free to add in the comment down below for the audience. See you guys in another article.

To know more about SQL please Wikipedia click here .

Stay Connected Stay Safe, Thank you


Basic Engineer

Hey Readers! We have more than fifteen years of experience in Software Development, IoT, Telecom, Banking, Finance and Embedded domain. Currently we are actively working on Data Science, ML and AI with multiple market leaders worldwide. Happy Reading. Cheers!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *