SQL Tutorials - SELECT Statement (Learn in 5 minutes)
The Select Statement
- The SQL 'SELECT' statement is used to select a particular set of columns from a particular table or database.
- The output of 'SELECT' statement also depends on various conditions, which we will discuss in detail.
Q). Select all data from a table named 'Avengers'
Here, our input would be as follows:
SELECT *
FROM Avengers
Its quite confusing right ?, Why did we use a '*' here ?, It is because a '*' is used to select all data from the entire table or database. FROM is used to get data from the particular table
Q) Select all the names from the table 'Avengers'
Here, our input would be as follows:
SELECT names
FROM Avengers
Here, names is a column in the table Avengers. In this way, we can select a particular column from a table.
Q) Select all the names, ages from the table Avengers
Here, our input would be as follows:
SELECT names, ages
FROM Avengers
In this way, we can select multiple columns in any table or database.
Points to Remember:
- The SELECT Statement is used to one or more columns from any particular table or database.
- The '*' is used to get all records from the table.
- FROM is used to get data from a particular table or database.
Syntax:
SELECT column_name(s)
FROM table_name
Comments
Post a Comment