SQL Introduction, Components & Structure MCQs: 12 Solved Questions
Test your SQL foundations with 12 explained MCQs covering terminology, query behaviour, metadata, dynamic SQL, database models and QBE.
KnowledgeGate Team
Exam prep & CS education

Introductory SQL MCQs are easy to underestimate because exam setters mix vocabulary with precise traps about duplicates, indexes, metadata and query construction. SQL spans data definition, queries, updates, permissions and transaction control; its interfaces include dynamic SQL and query by example. Commit to an option before reading each explanation. Topic-level practice for terminology, syntax, metadata and interfaces sits in DataBase Management System/DBMS for topic-level practice.
SQL name, purpose and language class
First separate SQL's expansion, database role, domain and conventional language generation.
Question 1
What does SQL stand for?
A. Structured Query Language
B. Simple Query Language
C. Systematic Query Logic
D. Standard Query Level
Answer: A. Structured Query Language
SQL expands to Structured Query Language, the accepted name for the standard language used to define, query and change relational data. For example, SELECT name FROM Student; requests one column. Commands also define tables and update stored rows. The other choices are plausible-sounding expansions, not the accepted name.
Question 2
What is SQL primarily used for in the context of relational databases?
A. To design user interfaces
B. To create and manipulate databases
C. To display data on web pages
D. To format printed reports
Answer: B. To create and manipulate databases
SQL handles database structures and data. Use CREATE TABLE Student (roll_no INT);, insert roll number 101 with INSERT INTO Student VALUES (101);, then select it with SELECT * FROM Student WHERE roll_no = 101;. A UI, web page or report may consume the result, but SQL does not primarily design or format it.
Question 3
Which type of language is SQL?
A. Domain-Specific Language
B. General-Purpose Language
C. Both (A) and (B)
D. None of these
Answer: A. Domain-Specific Language
A domain-specific language serves a bounded problem area. SQL covers relational data definition, queries, updates, permissions and transaction control. A general-purpose language such as Python can build a web server, automate files and call a database. SQL is not intended to replace those application tasks. That wider scope makes option B a distractor, not SQL's classification.
Question 4
An example of a fourth-generation programming language is _________.
A. C
B. COBOL
C. MERCURY
D. SQL
Answer: D. SQL
In conventional exam taxonomy, SQL is a fourth-generation language because it is declarative. The user requests rows where marks >= 70; the database chooses an execution plan. In C, the programmer normally specifies control flow. The label describes abstraction, not language quality. Treat generation as the question's conventional classification, not an absolute modern ranking.
Query behaviour, report structure and data-type limits
Now watch for duplicates, optional indexes, pivoted output and implementation-specific limits.
Question 5
Which of the following is/are correct?
A. An SQL query automatically eliminates duplicates
B. An SQL query will not work if there are no indexes on the relations
C. SQL permits attributes names to be repeated in the same relation
D. None of these
Answer: D. None of these
All three assertions are false. This question also anchors the earlier SQL Query MCQs: 12 Solved (SELECT, Joins, Subqueries), which owns the deeper SELECT semantics and DDL, DML and DCL split. Here, the same stem tests a broader three-part distinction: duplicate handling, index independence and attribute-name uniqueness. For Student(roll_no, city) rows (101, Pune), (102, Pune) and (103, Delhi), a plain city query returns Pune twice; DISTINCT is explicit. Without an index, the DBMS can scan the table. One table requires unique column names, although joined tables may have same-named columns that need qualification.
Question 6
Representations such as those in the dept_year relation, with one column for each value of an attribute, are called _______; they are widely used in spreadsheets and reports and in data analysis tools.
A. Cross-tabs
B. Snapshot
C. Both Cross-tabs and Snapshot
D. All of the mentioned
Answer: A. Cross-tabs
A cross-tab is a pivoted representation where attribute values become columns. The year values 2024 and 2025, for example, become two columns while departments remain rows. A snapshot is data captured at one time, not this report shape.
Question 7
The maximum length of an attribute of type text is
A. 127
B. 255
C. 256
D. It is variable
Answer: D. It is variable
The correct answer is “It is variable” because implementations and concrete text types define different limits. The numbers 127, 255 and 256 are not universal maxima. A fixed limit needs a specific DBMS and type, and the same TEXT type need not behave identically everywhere.
SQL syntax, metadata and runtime construction
Question 8
Which of the following is used for single-line comment in SQL?
A. &&
B. /* ...*/
C. --
D. ##
Answer: C. --
In SELECT * FROM Student; -- returns every row, -- comments out the line's remainder. By contrast, /* ...*/ delimits a block comment. Neither && nor ## is the standard single-line SQL marker.
Question 9
The SQL analog of what is more conventionally known as the catalog is called the
A. Data manipulation
B. Information schema
C. Data definition language
D. Dynamic SQL
Answer: B. Information schema
The information schema exposes metadata about objects such as tables and columns. INFORMATION_SCHEMA.COLUMNS can provide column information for a table named Student. Data manipulation changes rows, DDL defines objects, and dynamic SQL constructs statements at runtime. None is the catalog name asked for here.
Question 10
Which SQL facility allows a generalized, online or interactive application to construct statements at runtime?
A. Standard SQL
B. Embedded SQL
C. Static SQL
D. Dynamic SQL
Answer: D. Dynamic SQL
Dynamic SQL creates or chooses a statement at runtime, useful when interactive filters are not known in advance. If a user chooses 70, the string may become SELECT name FROM Student WHERE marks >= 70. Static SQL's statement shape is fixed before execution.
Database products and query-by-example interfaces
Question 11
Microsoft SQL Server is a:
A. Object-oriented database management system
B. Network database management system
C. Relational database management system
D. Hierarchical database management system
Answer: C. Relational database management system
SQL Server organises tables related through keys, so it is an RDBMS. For example, Student(roll_no, dept_id) joins Department(dept_id, name) through the department key. Object-oriented, network and hierarchical systems use different primary data models.
Question 12
In DBMS, which statements about query by example (QBE) are correct?
I. A query-by-example form collects user criteria for composing search statements.
II. Query by example relieves users from remembering query-language keywords and syntax.
A. Only I
B. Neither I nor II
C. Both I and II
D. Only II
Answer: C. Both I and II
Statement I is correct because a QBE form gathers search criteria. Statement II is correct because it translates choices into syntax. Inputs Department = CSE and Year = 2025 can produce WHERE Department = 'CSE' AND Year = 2025. The user supplies values without remembering keywords, so both statements hold.
Trace five recurring SQL traps with actual values
The same Student and dept_year rows distinguish duplicate handling, index independence, cross-tab shape, runtime query construction and QBE.
Duplicates and indexes
For Student(roll_no, city) rows (101, Pune), (102, Pune) and (103, Delhi), SELECT city FROM Student; returns three rows: Pune, Pune, Delhi. Adding DISTINCT returns two: Pune, Delhi. Removing an index on city changes neither query's validity; the DBMS can scan all three rows. Thus 3 input rows give 3 ordinary rows, while 2 unique values give 2 distinct rows.
Cross-tab shape
Start with dept_year(dept, year, students) rows (CSE, 2024, 120), (CSE, 2025, 135), (ECE, 2024, 95) and (ECE, 2025, 110). Pivoting year gives:
dept | 2024 | 2025 |
|---|---|---|
CSE | 120 | 135 |
ECE | 95 | 110 |
There are 2 departments × 2 years = 4 source combinations. The values 2024 and 2025 becoming columns are the cross-tab clue.
Runtime query and QBE
A form accepts marks = 70, Department = CSE and Year = 2025. Dynamic SQL may construct SELECT name FROM Student WHERE marks >= 70; QBE may hide WHERE Department = 'CSE' AND Year = 2025 from the user. The concepts are related, not identical.
Answer key and last-minute trap checklist
Q | Answer | Rule to retain |
|---|---|---|
1 | A | SQL expands to Structured Query Language. |
2 | B | SQL creates, queries and changes relational data and structures. |
3 | A | SQL is a database-focused domain-specific language. |
4 | D | SQL is conventionally classified as a declarative fourth-generation language in exam taxonomy. |
5 | D | Duplicates are not removed automatically; indexes affect access speed, not basic query validity; one table cannot repeat a column name. |
6 | A | Values becoming report columns signal a cross-tab. |
7 | D | Text limits depend on the DBMS and type. |
8 | C |
|
9 | B | The information schema is the SQL metadata catalog. |
10 | D | Dynamic SQL is assembled or selected at runtime. |
11 | C | Microsoft SQL Server is an RDBMS. |
12 | C | QBE gathers criteria and hides query-language syntax. |
If you missed Questions 1 to 4, revise terminology. If you missed Questions 5 to 10, revise SQL semantics and components. If you missed Questions 11 or 12, revise product and interface classifications.
Wait ten minutes, redo only the questions you missed without looking at the key, and explain aloud why each rejected option is wrong.
The short version and the next practice step
SQL is domain-specific and declarative. Queries may preserve duplicates and work without indexes. The information schema exposes metadata; dynamic SQL and QBE solve different interaction problems.
If the concepts need another pass, study SQL Queries and Joins in DBMS: Worked Join and GROUP BY for worked joins and grouping. Then reattempt Questions 5, 9 and 10 without the explanations.
For guided DBMS coverage, use Computer Science Fundamentals for Placements, or choose your next topic from the CS Fundamentals category.
Keep learning

SQL Library Functions MCQs: 12 Solved Math, Aggregate, String and Date Questions
Practise 12 solved SQL library function MCQs with inside-out calculations, exact intermediate values and clear explanations of the common traps.

GROUP BY Clause MCQs: 10 Solved SQL Questions with Explanations
Solve ten published GROUP BY questions, then check each answer with row-level and group-level reasoning. Two full traces make the common SQL traps visible.

Third Normal Form (3NF) MCQs: 12 Solved Questions with Explanations
Solve 12 real 3NF exam MCQs with clear explanations, candidate-key closures, a raw-row decomposition, and the prime-attribute exception that separates 3NF from BCNF.

Second Normal Form (2NF) MCQs: 12 Solved Questions with Explanations
Test your 2NF understanding with 12 solved MCQs on full dependency, partial dependency, candidate keys, closures, and normal-form guarantees.