0% found this document useful (0 votes)
75 views

50mcq Test SQL

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

50mcq Test SQL

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Chapter 1: Introduction to Databases and SQL

1. What is a database?
- a) A collection of tables
- b) A collection of related data
- c) A type of software
- d) A programming language

2. Which type of database uses tables with rows and columns?


- a) Non-relational database
- b) Document database
- c) Relational database
- d) Graph database

3. Which of the following is an example of a non-relational database?


- a) MySQL
- b) PostgreSQL
- c) MongoDB
- d) Oracle Database

4. What does SQL stand for?


- a) Standard Query Language
- b) Simple Query Language
- c) Structured Query Language
- d) Sequential Query Language

5. Who developed SQL?


- a) Raymond Boyce and Donald Chamberlin
- b) Larry Page and Sergey Brin
- c) Tim Berners-Lee
- d) Bill Gates and Paul Allen

6. In which decade was SQL developed?


- a) 1950s
- b) 1960s
- c) 1970s
- d) 1980s

7. Which SQL command is used to retrieve data from a database?


- a) INSERT
- b) DELETE
- c) SELECT
- d) UPDATE

8. Which SQL command is used to delete data from a database?


- a) SELECT
- b) UPDATE
- c) DELETE
- d) INSERT

9. What is the basic structure of an SQL query to retrieve data?


- a) DELETE ... WHERE
- b) INSERT ... INTO
- c) SELECT ... FROM
- d) CREATE ... TABLE

10. Which SQL category includes commands like SELECT, INSERT, UPDATE, and DELETE?
- a) DDL
- b) DML
- c) DCL
- d) TCL

11. What does a table consist of in a database?


- a) Rows and columns
- b) Keys and relations
- c) Queries and functions
- d) Primary and foreign keys

12. What uniquely identifies each row in a table?


- a) Foreign Key
- b) Unique Key
- c) Primary Key
- d) Candidate Key

13. What is a Foreign Key?


- a) A column that uniquely identifies each row
- b) A key that links one table to another
- c) A key that stores unique values in a table
- d) A key used to create tables

14. Which SQL data type is used to store whole numbers?


- a) VARCHAR
- b) TEXT
- c) INT
- d) DATE

15. What is the purpose of the NOT NULL constraint in SQL?


- a) To ensure that a column has a unique value
- b) To ensure that a column is not empty
- c) To ensure that a column stores only positive numbers
- d) To ensure that a column has the default value

16. Which SQL constraint ensures that all values in a column are unique?
- a) CHECK
- b) UNIQUE
- c) NOT NULL
- d) PRIMARY KEY

17. What is the purpose of normalization in databases?


- a) To increase redundancy
- b) To organize data and reduce redundancy
- c) To delete unnecessary data
- d) To create new tables

18. What is a characteristic of a table in First Normal Form (1NF)?


- a) No atomic values
- b) Repeating groups in columns
- c) All values are atomic
- d) Multiple values per column

19. A table is in Second Normal Form (2NF) if it is already in 1NF and:


- a) There are no transitive dependencies
- b) All non-primary key columns are dependent on the whole primary key
- c) It contains atomic values
- d) It contains partial dependencies

20. What is the main focus of Third Normal Form (3NF)?


- a) No repeating groups
- b) No transitive dependencies
- c) No partial dependencies
- d) All of the above

21. What is the primary use of the SELECT statement?


- a) To update data
- b) To retrieve data
- c) To delete data
- d) To insert data

22. Which clause is used in SQL to filter records based on a condition?


- a) SELECT
- b) FROM
- c) WHERE
- d) LIMIT

23. How can you sort the results of a query in SQL?


- a) ORDER BY
- b) SORT BY
- c) FILTER BY
- d) GROUP BY

24. What is the use of the LIMIT clause in SQL?


- a) To restrict the columns returned
- b) To sort the data
- c) To limit the number of rows returned
- d) To group the data

25. Which clause is used to remove duplicate records in an SQL query?


- a) DISTINCT
- b) UNIQUE
- c) WHERE
- d) ORDER BY

26. Which SQL function is used to calculate the sum of a numeric column?
- a) COUNT()
- b) AVG()
- c) SUM()
- d) MAX()

27. What SQL command is used to insert new data into a table?
- a) SELECT
- b) UPDATE
- c) INSERT INTO
- d) ALTER TABLE

28. How do you update existing data in an SQL table?


- a) UPDATE ... SET
- b) SELECT ... SET
- c) INSERT ... INTO
- d) DELETE ... FROM

29. Which SQL operator is used to filter data based on multiple conditions?
- a) AND
- b) OR
- c) IN
- d) NOT

30. What is the correct syntax to delete a record from a table?


- a) DELETE ... FROM ... WHERE
- b) REMOVE ... FROM ... WHERE
- c) SELECT ... FROM ... WHERE
- d) INSERT ... INTO ... WHERE

31. Which function returns the average value of a numeric column?


- a) MAX()
- b) COUNT()
- c) AVG()
- d) SUM()

32. What keyword is used to retrieve unique values from a column?


- a) UNIQUE
- b) DISTINCT
- c) SINGLE
- d) DIFFERENT

33. Which of the following is an aggregate function in SQL?


- a) SELECT
- b) GROUP BY
- c) AVG()
- d) HAVING

34. What SQL clause is used to group rows that have the same values in specified
columns?
- a) ORDER BY
- b) GROUP BY
- c) WHERE
- d) HAVING

35. Which clause is used to filter data after grouping?


- a) HAVING
- b) WHERE
- c) ORDER BY
- d) LIMIT

36. What is the purpose of the JOIN clause in SQL?


- a) To retrieve data from multiple tables
- b) To delete data from multiple tables
- c) To update data in multiple tables
- d) To insert data into multiple tables

37. Which type of JOIN returns all records from the left table and the matched
records from the right table?
- a) INNER JOIN
- b) RIGHT JOIN
- c) LEFT JOIN
- d) FULL JOIN

38. What does the FULL JOIN do?


- a) Returns only matched records
- b) Returns records that have a match in both tables
- c) Returns all records when there is a match in either table
- d) Returns records that have no match in either table

39. Which SQL function returns the largest value of a column?


- a) SUM()
- b) MAX()
- c) COUNT()
- d) AVG()

40. What is the role of the UNION operator in SQL?


- a) Combine the results of two or more SELECT queries
- b) Filter the results of a SELECT query
- c) Sort the results of a query
- d) Group the results of a query

41. Which SQL command is used to save a transaction?


- a) SAVE
- b) COMMIT
- c) INSERT
- d) BACKUP

42. What command is used to undo a transaction in SQL?


- a) ROLLBACK
- b) COMMIT
- c) DELETE
- d) UPDATE

43. What is an index in SQL?


- a

) A table with a large number of rows


- b) A way to increase query performance
- c) A special type of query
- d) A method of storing foreign keys

44. Which type of index allows for faster retrieval of unique values in a column?
- a) Foreign Index
- b) Primary Index
- c) Composite Index
- d) Unique Index

45. What is the main disadvantage of using indexes?


- a) Increased disk space usage
- b) Slower data retrieval
- c) Increased cost of queries
- d) Decreased data integrity

46. Which statement about transactions is true?


- a) Transactions must always be completed
- b) Transactions are used only for SELECT queries
- c) Transactions ensure ACID properties
- d) Transactions are required for all database operations

47. What does ACID stand for in database transactions?


- a) Availability, Consistency, Isolation, Durability
- b) Atomicity, Consistency, Isolation, Durability
- c) Authentication, Confidentiality, Integrity, Data

48. What is a deadlock in databases?


- a) When two transactions wait indefinitely for each other to release resources

- b) When a transaction completes successfully


- c) When two tables cannot be joined
- d) When data cannot be inserted into a table

49. What is the purpose of a checkpoint in SQL transactions?


- a) To back up the database
- b) To save a point of the transaction
- c) To lock a table during a transaction
- d) To delete unwanted data

50. What is the purpose of a foreign key in a database?


- a) To identify each record in a table uniquely
- b) To enforce a link between two tables
- c) To ensure data redundancy
- d) To define default values in a table

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy