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
You are on page 1/ 3
1. Which of the following statements is true regarding Data Definition Language (DDL)?
A) DDL is used to manipulate data in a database.
B) DDL is used to define the structure of the database. C) DDL is used to retrieve data from a database. D) DDL is used to perform calculations on data. Answer: B) DDL is used to define the structure of the database. 2. Which DDL command is used to create a new table in a database? 3. A) CREATE TABLE 4. B) INSERT INTO 5. C) UPDATE TABLE 6. D) ALTER TABLE Answer: A) CREATE TABLE 7. In SQL, which keyword is used to specify the data type of a column when creating a table? 8. A) TYPE 9. B) DATA_TYPE 10. C) DATATYPE 11. D) VARCHAR Answer: D) VARCHAR 12. Which DDL command is used to modify the structure of an existing table in a database? 13. A) ALTER TABLE 14. B) UPDATE TABLE 15. C) MODIFY TABLE 16. D) CHANGE TABLE Answer: A) ALTER TABLE 17. What does the RENAME TO command do in DDL? 18. A) Changes the name of a table 19. B) Adds a new column to a table 20. C) Deletes a table from the database 21. D) Modifies the data type of a column Answer: A) Changes the name of a table 22. Which of the following statements defines a primary key in a SQL table creation statement? 23. A) PRIMARY 24. B) KEY 25. C) PRIMARY KEY 26. D) CONSTRAINT Answer: C) PRIMARY KEY 27. What is the purpose of the DROP TABLE command in DDL? 28. A) To add a new table to the database 29. B) To modify the structure of an existing table 30. C) To delete an existing table from the database 31. D) To rename an existing table Answer: C) To delete an existing table from the database 32. Which command is used to add a new column to an existing table in SQL? 33. A) ADD COLUMN 34. B) ALTER COLUMN 35. C) CREATE COLUMN 36. D) INSERT COLUMN Answer: A) ADD COLUMN 37. What is the purpose of the CONSTRAINT keyword in SQL DDL? 38. A) To define the data type of a column 39. B) To specify a condition that must be met for data to be entered into a column 40. C) To enforce referential integrity between tables 41. D) To specify the name of a table Answer: B) To specify a condition that must be met for data to be entered into a column 42. Which of the following is not a valid data type in SQL? 43. A) BOOLEAN 44. B) INTEGER 45. C) FLOAT 46. D) CHARACTER Answer: A) BOOLEAN 47. What does the PRIMARY KEY constraint enforce in SQL? 48. A) Ensures that all values in a column are unique 49. B) Restricts the values that can be entered into a column 50. C) Specifies a default value for a column 51. D) Determines the order of the rows in a table Answer: A) Ensures that all values in a column are unique 52. Which command is used to delete a column from an existing table in SQL? 53. A) DELETE COLUMN 54. B) DROP COLUMN 55. C) REMOVE COLUMN 56. D) ERASE COLUMN Answer: B) DROP COLUMN 57. What does the CASCADE keyword do when used with the DROP TABLE command? 58. A) Deletes all data in the table 59. B) Deletes the table and all related tables 60. C) Renames the table 61. D) Adds a new column to the table Answer: B) Deletes the table and all related tables 62. Which DDL command is used to add a constraint to an existing table in SQL? 63. A) ADD CONSTRAINT 64. B) CREATE CONSTRAINT 65. C) DEFINE CONSTRAINT 66. D) SET CONSTRAINT Answer: A) ADD CONSTRAINT 67. Which of the following statements about DDL is true? 68. A) DDL commands cannot be rolled back once executed. 69. B) DDL is primarily used to query data from a database. 70. C) DDL is used to manipulate data stored in a database. 71. D) DDL commands are not case-sensitive. Answer: A) DDL commands cannot be rolled back once executed. 1. What is the primary purpose of Data Manipulation Language (DML)? 2. A) To define the structure of a database. 3. B) To retrieve data from a database. 4. C) To manipulate data stored in a database. 5. D) To manage user access to a database. Answer: C) To manipulate data stored in a database. 6. Which DML command is used to retrieve data from a database table? 7. A) SELECT 8. B) INSERT 9. C) UPDATE 10. D) DELETE Answer: A) SELECT 11. What does the INSERT INTO command do in DML? 12. A) Updates existing records in a table. 13. B) Deletes records from a table. 14. C) Inserts new records into a table. 15. D) Modifies the structure of a table. Answer: C) Inserts new records into a table. 16. Which command is used to modify existing data in a database table? 17. A) INSERT 18. B) DELETE 19. C) UPDATE 20. D) ALTER Answer: C) UPDATE 21. What is the purpose of the DELETE FROM command in DML? 22. A) To insert new records into a table. 23. B) To modify existing records in a table. 24. C) To delete specific records from a table. 25. D) To retrieve data from a table. Answer: C) To delete specific records from a table. 26. Which keyword is used to specify the condition for selecting records in a SELECT statement? 27. A) WHERE 28. B) FROM 29. C) SELECT 30. D) HAVING Answer: A) WHERE 31. What does the TRUNCATE TABLE command do in DML? 32. A) Deletes all records from a table. 33. B) Deletes the table structure. 34. C) Updates existing records in a table. 35. D) Inserts new records into a table. Answer: A) Deletes all records from a table. 36. Which command is used to remove a table's structure along with all its data? 37. A) DELETE 38. B) TRUNCATE TABLE 39. C) DROP TABLE 40. D) REMOVE TABLE Answer: C) DROP TABLE 41. What does the JOIN clause do in a SELECT statement? 42. A) Combines data from multiple tables based on a related column. 43. B) Filters data based on specified conditions. 44. C) Orders the result set in ascending or descending order. 45. D) Groups rows that have the same values into summary rows. Answer: A) Combines data from multiple tables based on a related column. 46. Which DML command is used to retrieve distinct records from a table? 47. A) SELECT DISTINCT 48. B) SELECT UNIQUE 49. C) SELECT ALL 50. D) SELECT DIFFERENT Answer: A) SELECT DISTINCT 51. What does the ORDER BY clause do in a SELECT statement? 52. A) Groups rows that have the same values into summary rows. 53. B) Filters data based on specified conditions. 54. C) Specifies the columns by which the result set should be sorted. 55. D) Combines data from multiple tables based on a related column. Answer: C) Specifies the columns by which the result set should be sorted. 56. Which DML command is used to add a new record to a database table? 57. A) ADD 58. B) INSERT 59. C) CREATE 60. D) UPDATE Answer: B) INSERT 61. What is the purpose of the DISTINCT keyword in a SELECT statement? 62. A) To specify the columns to be included in the result set. 63. B) To filter data based on specified conditions. 64. C) To retrieve unique values from a column. 65. D) To sort the result set in ascending or descending order. Answer: C) To retrieve unique values from a column. 66. Which keyword is used to specify the columns to be included in the result set of a SELECT statement? 67. A) SELECT 68. B) FROM 69. C) WHERE 70. D) GROUP BY Answer: A) SELECT 71. What does the HAVING clause do in a SELECT statement? 72. A) Filters data based on specified conditions. 73. B) Specifies the columns by which the result set should be sorted. 74. C) Groups rows that have the same values into summary rows. 75. D) Filters grouped records based on specified conditions. Answer: D) Filters grouped records based on specified conditions. What is the primary purpose of Data Control Language (DCL)? A) To define the structure of a database. B) To manipulate data stored in a database. C) To control access to data in a database. D) To retrieve data from a database. Answer: C) To control access to data in a database. 1. Which DCL command is used to grant permissions to a user in a database? 2. A) GRANT 3. B) ALLOW 4. C) ACCESS 5. D) PERMIT Answer: A) GRANT 6. What does the REVOKE command do in DCL? 7. A) Grants permissions to a user. 8. B) Removes permissions from a user. 9. C) Creates a new user account. 10. D) Changes the password of a user. Answer: B) Removes permissions from a user. 11. Which keyword is used to specify the privileges to be granted or revoked in a GRANT or REVOKE statement? 12. A) TO 13. B) ON 14. C) WITH 15. D) FOR Answer: B) ON 16. What does the keyword ALL represent in a GRANT or REVOKE statement? 17. A) All privileges on all tables in the database. 18. B) All privileges on a specific table. 19. C) All users in the database. 20. D) All databases on the server. Answer: A) All privileges on all tables in the database. 21. Which DCL command is used to create a new user account in a database? 22. A) CREATE USER 23. B) ADD USER 24. C) REGISTER USER 25. D) MAKE USER Answer: A) CREATE USER 26. What is the purpose of the WITH GRANT OPTION clause in a GRANT statement? 27. A) It specifies the privileges to be granted. 28. B) It allows the user to grant the same privileges to other users. 29. C) It specifies the database objects on which the privileges apply. 30. D) It specifies the users to whom the privileges are granted. Answer: B) It allows the user to grant the same privileges to other users. 31. Which DCL command is used to remove a user account from a database? 32. A) DELETE USER 33. B) REMOVE USER 34. C) DROP USER 35. D) REVOKE USER Answer: C) DROP USER 36. What does the GRANT OPTION FOR clause allow in a GRANT statement? 37. A) It allows the user to grant the same privileges to other users. 38. B) It specifies the privileges to be granted. 39. C) It specifies the database objects on which the privileges apply. 40. D) It specifies the users to whom the privileges are granted. Answer: A) It allows the user to grant the same privileges to other users. 41. Which keyword is used to specify the users or roles to whom permissions are granted or revoked in a GRANT or REVOKE statement? 42. A) TO 43. B) FOR 44. C) WITH 45. D) BY Answer: A) TO 46. What does the keyword PUBLIC represent in a GRANT or REVOKE statement? 47. A) All privileges on all tables in the database. 48. B) All users in the database. 49. C) All privileges on a specific table. 50. D) All databases on the server. Answer: B) All users in the database. 51. Which DCL command is used to change the privileges granted to a user in a database? 52. A) MODIFY 53. B) CHANGE PERMISSIONS 54. C) ALTER USER 55. D) REVOKE Answer: D) REVOKE 56. What does the keyword CASCADE do in a REVOKE statement? 57. A) Removes the user's permissions. 58. B) Revokes the permissions from all users. 59. C) Revokes the permissions from the specified user and all users to whom they granted permissions. 60. D) Revokes the permissions and drops the user account. Answer: C) Revokes the permissions from the specified user and all users to whom they granted permissions. 61. Which DCL command is used to grant privileges to a role in a database? 62. A) GRANT ROLE 63. B) ASSIGN ROLE 64. C) CREATE ROLE 65. D) ADD ROLE Answer: C) CREATE ROLE 66. What does the IDENTIFIED BY clause do in a CREATE USER statement? 67. A) Specifies the privileges to be granted to the user. 68. B) Specifies the database objects on which the privileges apply. 69. C) Specifies the users or roles to whom permissions are granted or revoked. 70. D) Specifies the password for the user account. Answer: D) Specifies the password for the user account.