SQL MCQ for Students

SQL is an integral part of all the programming and software, without SQL we can not even imagine any large software. courses. SQL is powering almost 80% of the web applications. SQL MCQ for the student will enhance their understanding of SQL. So let’s enjoy the best of SQL in the form of multiple-choice questions.
SQL MCQ for students
Q 1. What is the full form of SQL?

A) Structured Query Language
B) Structured Query List
C) Simple Query Language
D) None of these

Show Answer

Answer: Option A
Solution: SQL (Structured Query Language) is a special-purpose programming language designed for managing data held in a relational database management system (RDBMS).
Originally based upon relational algebra and tuple relational calculus, SQL consists of a data definition language and a data manipulation language. The scope of SQL includes data insert, query, update and delete, schema creation and modification, and data access control.


Q 2. Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?

A) Data Definition Language(DDL)
B) Data Manipulation Language(DML)
C) Both of above
D) None
Show Answer

Answer: Option A
Solution: The Data Definition Language (DDL) is used to manage table and index structure.
CREATE, ALTER, RENAME, DROP and TRUNCATE statements are the names of few data definition elements.


Q 3. Which operator performs pattern matching?

A) BETWEEN operator
B) LIKE operator
C) EXISTS operator
D) None of these
Show Answer

Answer: Option B
Solution: LIKE is a keyword that is used in the WHERE clause. Basically, LIKE allows us to do a search based operation on a pattern rather than specifying exactly what is desired (as in IN) or spell out a range (as in BETWEEN).
The syntax is as follows:
SELECT “column_name”
FROM “table_name”
WHERE “column_name” LIKE {PATTERN}
{PATTERN} often consists of wildcards. In SQL, there are two wildcards:
1=% (percent sign) represents zero, one, or more characters.
2=_ (underscore) represents exactly one character.


Q 4. What operator tests column for the absence of data?

A) EXISTS operator
B) NOT operator
C) IS NULL operator
D) None of these
Show Answer

Answer: Option C
Solution: Always use IS NULL to look for NULL values.
Syntax: SELECT “column_name”
FROM “table_name”
WHERE “column_name” IS NULL


Q 5. In SQL, which command(s) is(are) used to change a table’s storage characteristics?

A) ALTER TABLE
B) MODIFY TABLE
C) CHANGE TABLE
D) All of the above
Show Answer

Answer: Option A
Solution: To change the structure of the table we use ALTER TABLE.
Sytax:
ALTER TABLE “table_name”
ADD “column_name” datatype
OR
ALTER TABLE “table_name”
DROP COLUMN “column_name”
etc..


Q 6. In SQL, which of the following is not a data definition language commands?

A) RENAME
B) REVOKE
C) GRANT
D) UPDATE
Show Answer

Answer: Option D
Solution: RENAME: – With RENAME statement you can rename a table.
REVOKE: – The REVOKE command removes user access rights or privileges to the database objects.
GRANT: – In SQL GRANT is a command used to provide access or privileges on the database objects to the users.
UPDATE: – The UPDATE Statement is used to modify the existing rows in a table.
RENAME, REVOKE and GRANT are DDL(Data Definition Language) commands and UPDATE is DML(Data Manipulation Language) command.


Q 7. In SQL, which command is used to SELECT only one copy of each set of duplicable rows

A) SELECT DISTINCT
B) SELECT UNIQUE
C) SELECT DIFFERENT
D) All of the above
Show Answer

Answer: Option A
Solution: The SELECT keyword allows us to grab all information from a column (or columns) on a table. This, of course, necessarily means that there will be redundancies. What if we only want to select each distinct element? This is easy way to accomplish in SQL. All we need to do is that to add DISTINCT after SELECT. The syntax is as follows:
SELECT DISTINCT column_name
FROM table_name;

Related Posts

If you like CBSEToaday and would like to contribute, you can also write an article using submit article or mail your article to contribute@cbsetoday.com See your article appearing on the cbsetoday.com main page and help other students/teachers.