SQL Select Statement
The Select statement is used to select or fetch data from the database table.The data return from the database table as the result table is also known as the result-set.
SELECT Syntax :
The syntax of the SELECT statement is −
SELECT column1, column2, column3, columnN FROM table-name;
column1 , column2, column3: names of the fields of the table
table-name: table where we want to fetch data
If we want to select all the columns from the respective table then we use the following syntax:
SELECT * FROM table-name;
SELECT Example :
Consider the Customer table with the following records -
Test Case:-The following code is an example, which would fetch the CustomerName and Address fields of the Customer available in Customer table.
SELECT CustomerName, Address FROM Customer;
The result for the respective sql query is as follows −
1. Which of the following statements contains an error?
Explanation: This query do not have from clause which specifies the relation from which the values has to be selected.
2. Which of the following statements does not contains an error?
Explanation:Select empid from emp where empid = 10006; is correct statement among all.