SELECT Command in SQL
For Complete YouTube Video: Click Here
In this class, we will understand SELECT Command in SQL.
We have already discussed the concepts of truncate and drop table commands.
Table of Contents
SELECT Command in SQL
In this class, we will understand the basics of the select command.
The SELECT command is Data Query Language DQL.
The SELECT statement is used to select or retrieve data from a database.
The Select command is used to question the database.
Based on the question, we will get the answer.
The data returned is stored in a result table.
Syntax for SELECT
To understand this, we will use our user’s table, as shown below.
SELECT * FROM users;
SELECT is a keyword.
The * symbol is used to display all the rows in the table.
FROM is a keyword.
The output of the query is as shown below.
After FROM, we have to provide the table’s name from which we want to retrieve the data.
SELECTING specific columns from the table
Using *, we have selected a complete table.
If we want to display only specific columns of the table, then the syntax is shown below.
Between the SELECT and FROM keywords, we have to mention the column to be displayed.
By mentioning the columns, we can divide the table vertically.
For example, consider the query given below.
SELECT name FROM users;
From the above table, we want only the name column values to be displayed.
The output of the query is as shown below.
What if we want to display only specific rows of the table.
We will understand in our next class.