0% found this document useful (0 votes)
5 views19 pages

SQL and NoSQL Database Concepts

This document consists of a series of questions and answers related to databases, covering both SQL and NoSQL concepts. Key topics include relational databases, SQL statements, database schemas, and characteristics of various NoSQL databases. It provides definitions and explanations for terms such as primary keys, foreign keys, normalization, and different types of database management systems.

Uploaded by

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

SQL and NoSQL Database Concepts

This document consists of a series of questions and answers related to databases, covering both SQL and NoSQL concepts. Key topics include relational databases, SQL statements, database schemas, and characteristics of various NoSQL databases. It provides definitions and explanations for terms such as primary keys, foreign keys, normalization, and different types of database management systems.

Uploaded by

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

# Databases (SQL/NoSQL) - Section 2

1. What is a relational database?\


A) A database storing unstructured data\
B) A database using tables with relationships\
C) A database for graph data\
D) A database for key-value pairs\
**Answer: B) A database using tables with relationships**

2. Which SQL statement retrieves data from a database?\


A) INSERT\
B) SELECT\
C) UPDATE\
D) DELETE\
**Answer: B) SELECT**

3. What is a primary key in a relational database?\


A) A column allowing duplicate values\
B) A unique identifier for a table row\
C) A column for storing text\
D) A column for indexing\
**Answer: B) A unique identifier for a table row**

4. Which NoSQL database type stores data as key-value pairs?\


A) Document\
B) Column-family\
C) Key-value\
D) Graph\
**Answer: C) Key-value**

5. What does SQL stand for?\


A) Standard Query Language\
B) Structured Query Language\
C) Simple Query Language\
D) Sequential Query Language\
**Answer: B) Structured Query Language**
6. Which SQL clause filters query results?\
A) ORDER BY\
B) GROUP BY\
C) WHERE\
D) HAVING\
**Answer: C) WHERE**

7. Which NoSQL database is best for hierarchical data?\


A) Key-value\
B) Document\
C) Column-family\
D) Relational\
**Answer: B) Document**

8. What is a foreign key in a relational database?\


A) A unique identifier for a table\
B) A column linking to another table’s primary key\
C) A column for indexing\
D) A column for sorting\
**Answer: B) A column linking to another table’s primary key**

9. Which SQL statement adds data to a table?\


A) SELECT\
B) INSERT\
C) UPDATE\
D) DELETE\
**Answer: B) INSERT**

10. Which NoSQL database is suited for complex relationships?\


A) Key-value\
B) Document\
C) Graph\
D) Column-family\
**Answer: C) Graph**

11. What is the purpose of the SQL JOIN clause?\


A) To delete rows\
B) To combine rows from multiple tables\
C) To update rows\
D) To sort rows\
**Answer: B) To combine rows from multiple tables**

12. Which is a popular relational database management system (RDBMS)?\


A) MongoDB\
B) MySQL\
C) Cassandra\
D) Redis\
**Answer: B) MySQL**

13. What is a NoSQL database characteristic?\


A) Fixed schema\
B) Flexible schema\
C) Table-based structure\
D) Strict normalization\
**Answer: B) Flexible schema**

14. Which SQL statement modifies existing data?\


A) SELECT\
B) INSERT\
C) UPDATE\
D) DELETE\
**Answer: C) UPDATE**

15. Which NoSQL database is column-based?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: B) Cassandra**

16. What ensures data consistency in a relational database?\


A) Normalization\
B) Denormalization\
C) Indexing\
D) Partitioning\
**Answer: A) Normalization**
17. Which SQL clause groups rows with similar values?\
A) WHERE\
B) GROUP BY\
C) ORDER BY\
D) HAVING\
**Answer: B) GROUP BY**

18. Which NoSQL database is best for caching?\


A) MongoDB\
B) Cassandra\
C) Redis\
D) Neo4j\
**Answer: C) Redis**

19. What is the purpose of an SQL index?\


A) To store data\
B) To improve query performance\
C) To link tables\
D) To delete data\
**Answer: B) To improve query performance**

20. Which SQL statement removes data from a table?\


A) SELECT\
B) INSERT\
C) UPDATE\
D) DELETE\
**Answer: D) DELETE**

21. Which NoSQL database stores JSON-like documents?\


A) Redis\
B) MongoDB\
C) Cassandra\
D) Neo4j\
**Answer: B) MongoDB**

22. What is a database schema?\


A) A query to retrieve data\
B) The structure of a database\
C) A database backup\
D) A database index\
**Answer: B) The structure of a database**

23. Which SQL clause sorts query results?\


A) WHERE\
B) GROUP BY\
C) ORDER BY\
D) HAVING\
**Answer: C) ORDER BY**

24. Which NoSQL database is best for social network data?\


A) Redis\
B) MongoDB\
C) Neo4j\
D) Cassandra\
**Answer: C) Neo4j**

25. What is the purpose of the SQL HAVING clause?\


A) To filter rows before grouping\
B) To filter grouped results\
C) To sort rows\
D) To join tables\
**Answer: B) To filter grouped results**

26. Which is a popular SQL database?\


A) PostgreSQL\
B) MongoDB\
C) Redis\
D) Cassandra\
**Answer: A) PostgreSQL**

27. What is denormalization in databases?\


A) Reducing data redundancy\
B) Increasing data redundancy for performance\
C) Creating indexes\
D) Partitioning tables\
**Answer: B) Increasing data redundancy for performance**

28. Which SQL statement creates a new table?\


A) CREATE TABLE\
B) ALTER TABLE\
C) DROP TABLE\
D) TRUNCATE TABLE\
**Answer: A) CREATE TABLE**

29. Which NoSQL database is best for large-scale analytics?\


A) Redis\
B) MongoDB\
C) Cassandra\
D) Neo4j\
**Answer: C) Cassandra**

30. What is a database transaction?\


A) A single query\
B) A sequence of operations as a single unit\
C) A table index\
D) A database backup\
**Answer: B) A sequence of operations as a single unit**

31. Which SQL clause specifies conditions for joins?\


A) WHERE\
B) ON\
C) GROUP BY\
D) ORDER BY\
**Answer: B) ON**

32. Which NoSQL database uses a graph structure?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: C) Neo4j**

33. What ensures data integrity in a relational database?\


A) Constraints\
B) Indexes\
C) Views\
D) Triggers\
**Answer: A) Constraints**

34. Which SQL statement modifies a table’s structure?\


A) CREATE TABLE\
B) ALTER TABLE\
C) DROP TABLE\
D) TRUNCATE TABLE\
**Answer: B) ALTER TABLE**

35. Which NoSQL database is in-memory?\


A) MongoDB\
B) Cassandra\
C) Redis\
D) Neo4j\
**Answer: C) Redis**

36. What is the purpose of the SQL DISTINCT keyword?\


A) To sort rows\
B) To remove duplicate rows\
C) To join tables\
D) To group rows\
**Answer: B) To remove duplicate rows**

37. Which is a characteristic of a NoSQL database?\


A) Strict schema\
B) Horizontal scaling\
C) Table-based structure\
D) Fixed relationships\
**Answer: B) Horizontal scaling**

38. What is a database view?\


A) A physical table\
B) A virtual table based on a query\
C) A database index\
D) A database backup\
**Answer: B) A virtual table based on a query**

39. Which SQL statement deletes a table?\


A) CREATE TABLE\
B) ALTER TABLE\
C) DROP TABLE\
D) TRUNCATE TABLE\
**Answer: C) DROP TABLE**

40. Which NoSQL database is document-oriented?\


A) Redis\
B) MongoDB\
C) Cassandra\
D) Neo4j\
**Answer: B) MongoDB**

41. What is the purpose of the SQL GROUP BY clause?\


A) To filter rows\
B) To group rows for aggregation\
C) To sort rows\
D) To join tables\
**Answer: B) To group rows for aggregation**

42. Which SQL function calculates the total of a column?\


A) COUNT\
B) SUM\
C) AVG\
D) MAX\
**Answer: B) SUM**

43. Which NoSQL database is best for time-series data?\


A) InfluxDB\
B) MongoDB\
C) Neo4j\
D) Redis\
**Answer: A) InfluxDB**
44. What is a composite key in a relational database?\
A) A single column key\
B) Multiple columns forming a unique key\
C) A foreign key\
D) An index\
**Answer: B) Multiple columns forming a unique key**

45. Which SQL statement removes all rows from a table?\


A) CREATE TABLE\
B) ALTER TABLE\
C) DROP TABLE\
D) TRUNCATE TABLE\
**Answer: D) TRUNCATE TABLE**

46. Which NoSQL database supports wide-column storage?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: B) Cassandra**

47. What is the purpose of the SQL INNER JOIN?\


A) To return all rows from both tables\
B) To return matching rows from both tables\
C) To return non-matching rows\
D) To return sorted rows\
**Answer: B) To return matching rows from both tables**

48. Which SQL function counts rows?\


A) COUNT\
B) SUM\
C) AVG\
D) MAX\
**Answer: A) COUNT**

49. Which NoSQL database is best for real-time analytics?\


A) MongoDB\
B) Cassandra\
C) Redis\
D) Neo4j\
**Answer: C) Redis**

50. What is database normalization?\


A) Adding redundant data\
B) Reducing data redundancy\
C) Creating indexes\
D) Partitioning tables\
**Answer: B) Reducing data redundancy**

51. Which SQL clause filters groups after GROUP BY?\


A) WHERE\
B) HAVING\
C) ORDER BY\
D) ON\
**Answer: B) HAVING**

52. Which NoSQL database is best for recommendation systems?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: C) Neo4j**

53. What is a database trigger?\


A) A stored procedure executed automatically\
B) A query to retrieve data\
C) A table index\
D) A database backup\
**Answer: A) A stored procedure executed automatically**

54. Which SQL statement grants permissions?\


A) GRANT\
B) REVOKE\
C) DENY\
D) ALTER\
**Answer: A) GRANT**
55. Which NoSQL database is key-value based?\
A) MongoDB\
B) Cassandra\
C) Redis\
D) Neo4j\
**Answer: C) Redis**

56. What is the purpose of the SQL LEFT JOIN?\


A) To return all rows from the left table\
B) To return matching rows only\
C) To return non-matching rows\
D) To return sorted rows\
**Answer: A) To return all rows from the left table**

57. Which SQL function finds the maximum value?\


A) COUNT\
B) SUM\
C) AVG\
D) MAX\
**Answer: D) MAX**

58. Which NoSQL database is best for unstructured data?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: A) MongoDB**

59. What is a database stored procedure?\


A) A precompiled SQL code block\
B) A table index\
C) A database backup\
D) A query to retrieve data\
**Answer: A) A precompiled SQL code block**

60. Which SQL statement revokes permissions?\


A) GRANT\
B) REVOKE\
C) DENY\
D) ALTER\
**Answer: B) REVOKE**

61. Which NoSQL database is column-family based?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: B) Cassandra**

62. What is the purpose of the SQL RIGHT JOIN?\


A) To return all rows from the right table\
B) To return matching rows only\
C) To return non-matching rows\
D) To return sorted rows\
**Answer: A) To return all rows from the right table**

63. Which SQL function calculates the average?\


A) COUNT\
B) SUM\
C) AVG\
D) MAX\
**Answer: C) AVG**

64. Which NoSQL database is best for network analysis?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: C) Neo4j**

65. What is a database constraint?\


A) A rule to enforce data integrity\
B) A query to retrieve data\
C) A table index\
D) A database backup\
**Answer: A) A rule to enforce data integrity**

66. Which SQL statement creates an index?\


A) CREATE INDEX\
B) ALTER INDEX\
C) DROP INDEX\
D) TRUNCATE INDEX\
**Answer: A) CREATE INDEX**

67. Which NoSQL database is best for high write throughput?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: B) Cassandra**

68. What is the purpose of the SQL FULL JOIN?\


A) To return all rows from both tables\
B) To return matching rows only\
C) To return non-matching rows\
D) To return sorted rows\
**Answer: A) To return all rows from both tables**

69. Which SQL function finds the minimum value?\


A) COUNT\
B) SUM\
C) AVG\
D) MIN\
**Answer: D) MIN**

70. Which NoSQL database is best for session storage?\


A) MongoDB\
B) Cassandra\
C) Redis\
D) Neo4j\
**Answer: C) Redis**

71. What is database sharding?\


A) Dividing data across multiple servers\
B) Creating indexes\
C) Normalizing data\
D) Backing up data\
**Answer: A) Dividing data across multiple servers**

72. Which SQL clause specifies table aliases?\


A) AS\
B) ON\
C) WHERE\
D) GROUP BY\
**Answer: A) AS**

73. Which NoSQL database supports flexible schemas?\


A) MySQL\
B) PostgreSQL\
C) MongoDB\
D) Oracle\
**Answer: C) MongoDB**

74. What is the purpose of a database backup?\


A) To improve query performance\
B) To recover data after loss\
C) To create indexes\
D) To normalize data\
**Answer: B) To recover data after loss**

75. Which SQL statement deletes an index?\


A) CREATE INDEX\
B) ALTER INDEX\
C) DROP INDEX\
D) TRUNCATE INDEX\
**Answer: C) DROP INDEX**

76. Which NoSQL database is best for geospatial data?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: A) MongoDB**

77. What is a database transaction property?\


A) ACID\
B) CRUD\
C) REST\
D) SOAP\
**Answer: A) ACID**

78. Which SQL clause limits the number of rows returned?\


A) WHERE\
B) LIMIT\
C) GROUP BY\
D) ORDER BY\
**Answer: B) LIMIT**

79. Which NoSQL database is best for distributed systems?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: B) Cassandra**

80. What does the ‘A’ in ACID stand for?\


A) Availability\
B) Atomicity\
C) Accuracy\
D) Adaptability\
**Answer: B) Atomicity**

81. Which SQL statement creates a view?\


A) CREATE VIEW\
B) ALTER VIEW\
C) DROP VIEW\
D) TRUNCATE VIEW\
**Answer: A) CREATE VIEW**
82. Which NoSQL database is best for caching key-value data?\
A) MongoDB\
B) Cassandra\
C) Redis\
D) Neo4j\
**Answer: C) Redis**

83. What is the purpose of a database index?\


A) To store data\
B) To speed up data retrieval\
C) To link tables\
D) To delete data\
**Answer: B) To speed up data retrieval**

84. Which SQL clause combines multiple conditions?\


A) AND\
B) ON\
C) GROUP BY\
D) ORDER BY\
**Answer: A) AND**

85. Which NoSQL database is best for fraud detection?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: C) Neo4j**

86. What is a database cursor?\


A) A pointer to query results\
B) A table index\
C) A database backup\
D) A stored procedure\
**Answer: A) A pointer to query results**

87. Which SQL statement updates a view?\


A) CREATE VIEW\
B) ALTER VIEW\
C) DROP VIEW\
D) TRUNCATE VIEW\
**Answer: B) ALTER VIEW**

88. Which NoSQL database is best for high read/write operations?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: B) Cassandra**

89. What does the ‘C’ in ACID stand for?\


A) Consistency\
B) Concurrency\
C) Compression\
D) Connectivity\
**Answer: A) Consistency**

90. Which SQL clause negates a condition?\


A) NOT\
B) AND\
C) OR\
D) ON\
**Answer: A) NOT**

91. Which NoSQL database is best for document storage?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: A) MongoDB**

92. What is a database partition?\


A) Dividing a table into smaller parts\
B) Creating indexes\
C) Normalizing data\
D) Backing up data\
**Answer: A) Dividing a table into smaller parts**
93. Which SQL statement deletes a view?\
A) CREATE VIEW\
B) ALTER VIEW\
C) DROP VIEW\
D) TRUNCATE VIEW\
**Answer: C) DROP VIEW**

94. Which NoSQL database is best for IoT data?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: B) Cassandra**

95. What does the ‘I’ in ACID stand for?\


A) Integrity\
B) Isolation\
C) Index\
D) Interface\
**Answer: B) Isolation**

96. Which SQL clause combines rows with any matching condition?\
A) AND\
B) OR\
C) NOT\
D) ON\
**Answer: B) OR**

97. Which NoSQL database is best for social media analytics?\


A) MongoDB\
B) Cassandra\
C) Neo4j\
D) Redis\
**Answer: C) Neo4j**

98. What is a database replication?\


A) Copying data across servers\
B) Creating indexes\
C) Normalizing data\
D) Backing up data\
**Answer: A) Copying data across servers**

99. Which SQL function concatenates strings?\


A) CONCAT\
B) SUM\
C) AVG\
D) MAX\
**Answer: A) CONCAT**

Which NoSQL database is best for fast data retrieval?

A) MongoDB\
B) Cassandra\
C) Redis\
D) Neo4j\
**Answer: C) Redis**

You might also like