LearnFrenzy
Sign in Take a free test

DBMS & SQL · Topic 1 of 10

DBMS and SQL Fundamentals: questions with answers

DBMS concepts, SQL command families, filtering and sorting, NULL and three-valued logic, CASE, functions and basic DML.

Questions
45
Timed sets
3
Queries executed
28
Your accuracy
–

What this topic covers

33 subtopics
  • NULL3
  • Architecture2
  • Data types2
  • Dates2
  • DBMS basics2
  • LIMIT2
  • Logical operators2
  • Sorting NULL2
  • SQL command families2
  • String functions2
  • Three-valued logic2
  • Arithmetic1
Show all 33 subtopics
  • BETWEEN1
  • CASE1
  • Choosing a database1
  • COALESCE1
  • Collations1
  • Data models1
  • DELETE1
  • DISTINCT1
  • Distributed databases1
  • DML vs DDL1
  • IN1
  • INSERT … SELECT1
  • LIKE1
  • ORDER BY1
  • Relational model1
  • Security1
  • Stored programs1
  • UPDATE1
  • Views1
  • WHERE and ORDER BY1
  • Workloads1
  • Beginner 15
  • Intermediate 15
  • Advanced 15

About this topic

Start here. This topic covers what a DBMS adds over plain files, the families of SQL commands, and the everyday clauses – WHERE, ORDER BY, LIKE, BETWEEN, IN – that every later topic builds on. Pay special attention to NULL: it means "unknown", comparisons with it are neither true nor false, and that single rule explains most beginner surprises.

Free preview

Sample questions

Try each one first, then open the answer for the explanation and why the other options are wrong.

Question 1 DBMS basics Beginner Practice

Which is a key advantage of a DBMS over storing data in plain files?

It works without an operating system
It needs no storage
Controlled concurrent access, integrity constraints, recovery and a query language over shared data
Data can never be deleted
Show answer and explanation
Correct answer C

Explanation

A DBMS reduces redundancy, enforces constraints, lets many users work safely at once, recovers from crashes and answers ad-hoc queries – all of which file-based systems leave to each application.

Why the other options are wrong

  • AA DBMS runs on an operating system.
  • BData still needs storage.
  • DDeletion is a normal operation.
Question 2 NULL Beginner Practice Query executed

Keyboard's stock is NULL. What does this return?

products
idnamecategorypricestocklaunched
1PenStationery20.005002024-01-10
2NotebookStationery60.001202024-03-05
3BackpackBags899.00402025-06-01
4Laptop SleeveBags650.0002025-08-15
5MouseElectronics499.00752025-02-20
6KeyboardElectronics1299.00NULL2026-01-12
7MarkerStationery35.00300NULL
SELECT
  (SELECT COUNT(*) FROM products WHERE stock = NULL) AS with_equals,
  (SELECT COUNT(*) FROM products WHERE stock IS NULL) AS with_is;
with_equalswith_is
11
with_equalswith_is
00
with_equalswith_is
01
with_equalswith_is
10
Show answer and explanation
Correct answer C

Explanation

stock = NULL is UNKNOWN for every row, never true, so it matches nothing. Test for NULL with IS NULL / IS NOT NULL.

Why the other options are wrong

  • A= NULL never matches.
  • BIS NULL finds Keyboard.
  • DThis reverses the two.
Question 3 Logical operators Intermediate Practice Query executed

The author meant "bags or electronics, costing over 1000". What does the query actually return?

products
idnamecategorypricestocklaunched
1PenStationery20.005002024-01-10
2NotebookStationery60.001202024-03-05
3BackpackBags899.00402025-06-01
4Laptop SleeveBags650.0002025-08-15
5MouseElectronics499.00752025-02-20
6KeyboardElectronics1299.00NULL2026-01-12
7MarkerStationery35.00300NULL
SELECT COUNT(*) AS n FROM products
WHERE category = 'Bags' OR category = 'Electronics' AND price > 1000;
n
0
n
4
n
1
n
3
Show answer and explanation
Correct answer D

Explanation

AND binds tighter than OR, so it means Bags OR (Electronics AND price > 1000): both bags plus Keyboard = 3. With parentheses around the OR it would be 1. Always bracket mixed AND/OR.

Why the other options are wrong

  • ABags match unconditionally.
  • BMouse fails the price test.
  • CThat is the intended result, which needs parentheses.
Question 4 Three-valued logic Advanced Practice Query executed

How many products does NOT(…) return?

products
idnamecategorypricestocklaunched
1PenStationery20.005002024-01-10
2NotebookStationery60.001202024-03-05
3BackpackBags899.00402025-06-01
4Laptop SleeveBags650.0002025-08-15
5MouseElectronics499.00752025-02-20
6KeyboardElectronics1299.00NULL2026-01-12
7MarkerStationery35.00300NULL
SELECT COUNT(*) AS n FROM products WHERE NOT (stock > 100);
n
4
n
3
n
2
n
7
Show answer and explanation
Correct answer B

Explanation

For Keyboard, NULL > 100 is UNKNOWN and NOT UNKNOWN is still UNKNOWN, so the row is excluded. Matching rows: 40, 0 and 75 – three.

Why the other options are wrong

  • ANOT does not turn UNKNOWN into TRUE.
  • CLaptop Sleeve (0) matches.
  • DThree products have more than 100.
41 more questions in the timed setsSame format as the samples, with a timer, a question palette and a full review at the end.
Start practising

DBMS & SQL

All 10 topics

Topics, levels and full mocks
  1. 01 DBMS and SQL Fundamentals45 questions · 3 levels
  2. 02 Joins and Subqueries45 questions · 3 levels
  3. 03 Aggregates and GROUP BY45 questions · 3 levels
  4. 04 Window Functions45 questions · 3 levels
  5. 05 Keys and Constraints45 questions · 3 levels
  6. 06 ER Model and Relational Mapping45 questions · 3 levels
  7. 07 Normalization45 questions · 3 levels
  8. 08 Transactions and Concurrency45 questions · 3 levels
  9. 09 Indexing and Query Optimisation45 questions · 3 levels
  10. 10 Advanced SQL Queries45 questions · 3 levels

Search LearnFrenzy

Esc

Quick links