ExamVeda
Login
Home
1
You can add a row using SQL in a database with which of the following?
Discuss
Answer & Solution
Answer: Option C
Solution:
Option A: ADD - In SQL, ADD is not typically used to add new rows to a database table. It is more commonly used to add new columns to an existing table structure.
Option B: CREATE - The CREATE statement in SQL is used to create new database objects such as tables, indexes, or views. It is not used specifically for adding rows to a table.
Option C: INSERT - The INSERT statement in SQL is used to insert new rows into a table. You specify the table name and the values you want to insert into the new row.
Option D: MAKE - There is no standard SQL command or keyword called MAKE for adding rows to a database table.
Conclusion:
To add a new row to a database table in SQL, you use the INSERT statement. Therefore, the correct answer is Option C: INSERT.
2
The command to remove rows from a table 'CUSTOMER' is:
Discuss
Answer & Solution
Answer: Option C
Solution:
Option A: REMOVE FROM CUSTOMER ... - There is no SQL command called REMOVE. This option is incorrect.
Option B: DROP FROM CUSTOMER ... - The DROP command is used to remove entire tables or other database objects, not rows from a table. This option is incorrect.
Option C: DELETE FROM CUSTOMER WHERE ... - The DELETE command in SQL is used to remove rows from a table. You specify the table name (CUSTOMER) and use WHERE clause to specify which rows to delete based on a condition.
Option D: UPDATE FROM CUSTOMER ... - The UPDATE command is used to modify existing rows in a table, not to remove rows. This option is incorrect.
Conclusion:
To remove rows from a table 'CUSTOMER' in SQL, you use the DELETE statement with a WHERE clause to specify the condition for deletion. Therefore, the correct answer is Option C: DELETE FROM CUSTOMER WHERE ....
3
The SQL WHERE clause:
Discuss
Answer & Solution
Answer: Option B
Solution:
The SQL WHERE clause is used to filter records.

It limits the row data that are returned by specifying conditions that the records must meet.

Option A is incorrect because the WHERE clause does not limit column data; this is done by the SELECT statement.

Option C is incorrect because only Option B is correct.

Option D is incorrect because the WHERE clause does limit the row data that are returned.

Conclusion: The WHERE clause in SQL is used to filter rows based on specific conditions, limiting the row data returned.
4
Which of the following is the original purpose of SQL?
Discuss
Answer & Solution
Answer: Option D
Solution:
Option A: To specify the syntax and semantics of SQL data definition language - SQL was originally designed to define and manipulate data in databases, including creating and modifying database schemas. This option correctly describes one of the original purposes of SQL.
Option B: To specify the syntax and semantics of SQL manipulation language - SQL includes commands for querying and manipulating data stored in a database. This option correctly describes another original purpose of SQL.
Option C: To define the data structures - While SQL is used to define database structures such as tables and indexes, this statement alone does not encompass the original full scope of SQL's purposes.
Option D: All of the above - This option suggests that SQL serves all the purposes mentioned in Options A, B, and C. Given that Options A and B correctly describe SQL's original purposes, Option D is the correct answer.
Conclusion:
SQL was originally developed to specify both the syntax and semantics of its data definition language (DDL) for defining database structures and its manipulation language (DML) for querying and modifying data. Therefore, the correct answer is Option D: All of the above.
5
The wildcard in a WHERE clause is useful when?
Discuss
Answer & Solution
Answer: Option B
Solution:
Option A: An exact match is necessary in a SELECT statement. - This option describes when you need to specify a precise condition for selecting data, which is not related to the use of wildcards in SQL.
Option B: An exact match is not possible in a SELECT statement. - This option incorrectly describes the use of wildcards. Wildcards are used in SELECT statements to match patterns rather than exact values.
Option C: An exact match is necessary in a CREATE statement. - The CREATE statement is used to create database objects such as tables, indexes, or views, and does not relate to the use of wildcards.
Option D: An exact match is not possible in a CREATE statement. - This option incorrectly describes the purpose of wildcards in SQL.
Conclusion:
In SQL, wildcards in a WHERE clause are useful when you need to match patterns rather than exact values in a SELECT statement. Therefore, the correct answer is Option B: An exact match is not possible in a SELECT statement.
6
A view is which of the following?
Discuss
Answer & Solution
Answer: Option A
Solution:
Option A: A virtual table that can be accessed via SQL commands - This option correctly describes a view in SQL. A view is a virtual table based on the result-set of an SQL statement. It can be queried and manipulated using SQL commands, but it does not store data like a physical table.
Option B: A virtual table that cannot be accessed via SQL commands - This option is incorrect because views are specifically designed to be accessed via SQL commands.
Option C: A base table that can be accessed via SQL commands - This option describes a physical or base table, not a view.
Option D: A base table that cannot be accessed via SQL commands - This option is incorrect because base tables are accessed and manipulated using SQL commands.
Conclusion:
In SQL, a view is a virtual table that is created based on a SQL SELECT query. It can be queried like a regular table using SQL commands. Therefore, the correct answer is Option A: A virtual table that can be accessed via SQL commands.
7
The command to eliminate a table from a database is:
Discuss
Answer & Solution
Answer: Option B
Solution:
Option A: REMOVE TABLE CUSTOMER; - There is no SQL command called REMOVE TABLE. This option is incorrect.
Option B: DROP TABLE CUSTOMER; - The DROP TABLE command in SQL is used to remove a table from the database. This option correctly describes the command to eliminate a table.
Option C: DELETE TABLE CUSTOMER; - The DELETE command is used to remove rows from a table, not the table itself. This option is incorrect.
Option D: UPDATE TABLE CUSTOMER; - The UPDATE command is used to modify existing rows in a table, not to eliminate the table itself. This option is incorrect.
Conclusion:
To eliminate (delete) a table from a database in SQL, you use the DROP TABLE statement followed by the table name. Therefore, the correct answer is Option B: DROP TABLE CUSTOMER;.
8
ON UPDATE CASCADE ensures which of the following?
Discuss
Answer & Solution
Answer: Option B
Solution:
Option A: Normalization - ON UPDATE CASCADE in SQL is not directly related to normalization, which is a process of organizing data to minimize redundancy and dependency.
Option B: Data Integrity - This is the correct option. ON UPDATE CASCADE is a referential integrity constraint that ensures data integrity by automatically updating related records in child tables when the parent record is updated.
Option C: Materialized Views - ON UPDATE CASCADE does not relate to materialized views, which are views that store the results of a query physically for faster access.
Option D: All of the above - This option suggests that ON UPDATE CASCADE ensures all the benefits mentioned in Options A, B, and C. However, only Option B correctly describes the purpose of ON UPDATE CASCADE.
Conclusion:
In SQL, ON UPDATE CASCADE ensures data integrity by automatically updating related records in child tables when the parent record is updated. Therefore, the correct answer is Option B: Data Integrity.
9
SQL data definition commands make up a(n) ________ .
Discuss
Answer & Solution
Answer: Option A
Solution:
Option A: DDL - DDL stands for Data Definition Language. It consists of SQL commands used to define the database structure, such as creating and modifying tables, indexes, views, etc.
Option B: DML - DML stands for Data Manipulation Language. It consists of SQL commands used to manage data within the database, such as inserting, updating, deleting data.
Option C: HTML - HTML is not related to SQL data definition commands. HTML is a markup language used for creating web pages.
Option D: XML - XML is not related to SQL data definition commands. XML is a markup language used for encoding documents in a format that is both human-readable and machine-readable.
Conclusion:
SQL data definition commands, such as creating tables and defining their structure, are part of the Data Definition Language (DDL). Therefore, the correct answer is Option A: DDL.
10
Which of the following is valid SQL for an Index?
Discuss
Answer & Solution
Answer: Option A
Solution:
Option A: CREATE INDEX ID; - This option is correct. The CREATE INDEX statement in SQL is used to create an index on a table.
Option B: CHANGE INDEX ID; - There is no standard SQL command called CHANGE INDEX. This option is incorrect.
Option C: ADD INDEX ID; - There is no standard SQL command called ADD INDEX. This option is incorrect.
Option D: REMOVE INDEX ID; - There is no standard SQL command called REMOVE INDEX. This option is incorrect.
Conclusion:
In SQL, to create an index on a table, you use the CREATE INDEX statement followed by the index name. Therefore, the correct answer is Option A: CREATE INDEX ID;.