Home Interview Questions and Answers SQL Interview questions and Answers For Freshers Patr-4

sql31.What do you understand by a subquery? When is it used?
A subquery is a SELECT statement embedded in a clause of another SELECT statement. It is used when the inner query, o4r the subquery returns a value that is used by the outer query. It is very useful in selecting some rows in a table with a condition that depends on some data which is contained in the same table.

32.Say True or False. Give explanation if False.
A single row subquery returns only one row from the outer SELECT statement

False. A single row subquery returns only one row from the inner SELECT statement.

33.Say True or False. Give explanation if False.
A multiple row subquery returns more than one row from the inner SELECT statement.

True.

34.Say True or False. Give explanation if False.
Multiple column subqueries return more than one column from the inner SELECT statement.

True.

35.What’s wrong in the following query?
SELECT student_code, name
FROM students
WHERE marks =
(SELECT MAX(marks)
FROM students
GROUP BY subject_code);
Here a single row operator = is used with a multiple row subquery.

36.What are the various multiple row comparison operators in SQL?
IN, ANY, ALL.

37.What is the pupose of DML statements in SQL?
The DML statements are used to add new rows to a table, update or modify data in existing rows, or remove existing rows from a table.

38.Which statement is used to add a new row in a database table?
The INSERT INTO statement.

39.Say True or False. Give explanation if False.
While inserting new rows in a table you must list values in the default order of the columns.

True.

40.How do you insert null values in a column while inserting data?
Null values can be inserted into a table by one of the following ways −

Implicitly by omitting the column from the column list.
Explicitly by specifying the NULL keyword in the VALUES clause.

You may also like

Leave a Comment