Machine-translated by Google. Questions are authored in English.
Top

Introduction to SQL Questions and Answers

11.

Which of the following commands can be used SQL to delete all the records in the table work ?

Exam Year(s)

MH SET - 2024, SET Exam - 2024,

Answer: A

The command is Delete from work.

A DELETE statement without a WHERE clause removes every row from the table, while leaving the table and its structure in place.

Adding where Id = 'Null' deletes only rows whose Id is the string 'Null'. DROP TABLE removes the table itself, not just its records, and REMOVE TABLE is not an SQL command.

Please log in or register to report this question.

Answer: C

The equivalent query uses salary \(\gt\)= 70000 and salary \(\lt\)= 130000.

SQL's BETWEEN is inclusive: salary BETWEEN 70000 and 130000 is true for 70000 and for 130000 as well as for every value between them. So the rewrite needs greater-than-or-equal and less-than-or-equal.

Option A uses strict inequalities and drops the two end values. Option B asks for a salary equal to both numbers at once, which no row satisfies, and option D asks for a salary below 70000 and above 130000 together, which is also impossible.

Please log in or register to report this question.

13.

SQL command used to remove a table from the database is

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: B

The command is DROP.

DROP TABLE name removes the table entirely: its definition, all its rows, and its indexes and constraints. After it, the table no longer exists in the database.

DELETE removes rows (all of them, or those matching a WHERE clause) but leaves the table in place. TRUNCATE quickly removes all rows and also keeps the empty table structure. REMOVE is not an SQL command.

Please log in or register to report this question.

14.

Which of the following is an example of a Data Definition Language (DDL) command ?

Exam Year(s)

Tripura Public Service Commission - 2025,

Answer: C

The DDL command is CREATE.

Data Definition Language commands define and change the structure of database objects: CREATE, ALTER, DROP, TRUNCATE and RENAME.

SELECT, INSERT and UPDATE work on the data inside tables, so they are Data Manipulation Language (DML) commands (SELECT is sometimes classed as DQL).

DDL changes are usually auto-committed, so they cannot be rolled back the way DML changes can in a transaction.

Please log in or register to report this question.

Answer: A

The correct syntax is CREATE TABLE table_name (column1 datatype, column2 datatype,...) ;

In SQL a table is created with the DDL command CREATE TABLE, followed by the table name and, in brackets, each column with its data type and any constraints.

ADD TABLE, NEW TABLE and TABLE CREATE are not SQL commands. (ADD is used inside ALTER TABLE to add a column.)

Please log in or register to report this question.

16.

Which of the following SQL statements is used to modify the data in a table ?

Exam Year(s)

Tripura Public Service Commission - 2025,

Answer: C

Data in a table is modified with UPDATE.

UPDATE changes values in existing rows, for example UPDATE emp SET salary = 50000 WHERE id = 7;.

SELECT retrieves data, INSERT adds new rows, and DELETE removes rows, so none of them modifies existing data in place.

Without a WHERE clause, UPDATE changes every row of the table, a common and costly mistake.

Please log in or register to report this question.

17.

Which SQL clause filters records after grouping ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: D

The clause is HAVING.

A query is evaluated in the order FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY. HAVING applies a condition to each group after GROUP BY has formed it, and can therefore use aggregates, as in HAVING COUNT(*) > 5.

WHERE filters individual rows before grouping and cannot use aggregates. GROUP BY forms the groups but does not filter them. ORDER BY only sorts the result.

Please log in or register to report this question.

18.

In SQL, which clause is used to filter groups created by GROUP BY ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: B

The clause is HAVING.

HAVING filters the groups that GROUP BY produces, and it may use aggregate functions, for example SELECT dept, AVG(salary) FROM emp GROUP BY dept HAVING AVG(salary) > 50000.

WHERE filters rows before grouping and cannot use aggregates. ORDER BY only sorts the output. FILTER is a clause attached to an individual aggregate in some SQL dialects (as in COUNT(*) FILTER (WHERE ...)), not the clause that filters groups.

Please log in or register to report this question.

19.

Which SQL join returns all rows from both tables, with NULL values for non-matching rows ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: D

The join is the FULL OUTER JOIN.

A full outer join returns every matched row plus the unmatched rows from both tables, filling the missing side's columns with NULL. It is in effect the union of a left and a right outer join.

An INNER JOIN returns only matching rows. A LEFT JOIN keeps all rows of the left table, with NULLs for unmatched right-hand columns, and a RIGHT JOIN does the same for the right table. Each of them keeps the unmatched rows of one table only.

Please log in or register to report this question.

20.

Which SQL command is used to retrieve data from a table ?

Exam Year(s)

Tripura Public Service Commission - 2026,

Answer: C

Data is retrieved with SELECT.

SELECT is the data query command of SQL: SELECT columns FROM table WHERE condition returns the rows and columns asked for, without changing the table.

INSERT adds new rows, UPDATE changes values in existing rows, and DELETE removes rows. All three modify data rather than retrieving it.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Introduction to SQL Questions and Answers || Introduction to SQL MCQ Questions and Answers || Introduction to SQL GK Questions and Answers || Introduction to SQL GK MCQ Questions || Introduction to SQL Multiple Choice Questions and Answers || Introduction to SQL GK || GK on Introduction to SQL || Database Questions and Answers || Database MCQ Questions and Answers || Database GK Questions and Answers || GK on Database