Computer Science
Which of the following queries contains an error?
- Select * from emp where empid = 10003;
- Select empid from emp where empid = 10006;
- Select empid from emp;
- Select empid where empid = 1009 and lastname = 'GUPTA';
SQL Queries
3 Likes
Answer
Select empid where empid = 1009 and lastname = 'GUPTA';
Reason — This query lacks the FROM
clause. In SQL, the FROM
clause is required to specify the table from which we are selecting data. Without it, the query is incomplete and will result in a syntax error. The corrected query is as follows :
Select empid from emp where empid = 1009 and lastname = 'GUPTA';
Answered By
2 Likes
Related Questions
The …………… clause of SELECT query allows us to select only those rows in the result that satisfy a specified condition.
- Where
- from
- having
- like
…………… clause of the following query must be added with keyword …………… to display the fields given in the select list as per a given condition.
SELECT ID, name, dept name, salary * 1.1 WHERE instructor = 1005 ;
- where, having
- select, from
- where, from
- where, select
Consider the following table namely Employee :
Employee_id Name Salary 1001 Misha 6000 1009 Khushi 4500 1018 Japneet 7000 Which of the names will not be displayed by the below given query ?
SELECT name FROM employee WHERE employee_id > 1009 ;
- Misha, Khushi
- Khushi, Japneet
- Japneet
- Misha, Japneet
Which operator performs pattern matching ?
- BETWEEN operator
- LIKE operator
- EXISTS operator
- None of these