OA Exams

  • web.groovymark@gmail.com
  • November 7, 2024

Question 21

Which SQL statement is used to create a new view based on a SELECT query?

a) CREATE VIEW
b) NEW VIEW
c) ADD VIEW
d) DEFINE VIEW

Correct Answer: a) CREATE VIEW

Explanation: The CREATE VIEW statement defines a new view based on a SELECT query, simplifying data retrieval.

Question 22

Which SQL operator is used to test for a NULL value?

a) IS NULL
b) NULL TEST
c) IS EMPTY
d) NOT NULL

Correct Answer: a) IS NULL

Explanation: The IS NULL operator is used to test whether a value is NULL in SQL.

Question 23

What does the term ‘join’ refer to in SQL?

a) Combining data from two or more tables
b) Removing duplicates from a table
c) Sorting records in a table
d) Creating a new database

Correct Answer: a) Combining data from two or more tables

Explanation: A join in SQL combines data from two or more tables based on a related column between them.

Question 24

Which SQL function is used to return the length of a string?

a) LENGTH()
b) SIZE()
c) COUNT()
d) CHAR_LENGTH()

Correct Answer: a) LENGTH()

Explanation: The LENGTH() function returns the number of characters in a string in SQL.

Question 25

Which SQL clause is used to specify the number of rows to be returned?

a) LIMIT
b) TOP
c) RANK
d) COUNT

Correct Answer: a) LIMIT

Explanation: The LIMIT clause is used to restrict the number of rows returned by a SQL query.

Question 26

Which SQL statement is used to create a new database?

a) NEW DATABASE
b) CREATE DATABASE
c) ADD DATABASE
d) DEFINE DATABASE

Correct Answer: b) CREATE DATABASE

Explanation: The CREATE DATABASE statement is used to define a new database within the database management system.

Question 27

Which SQL keyword is used to specify an alternative value if a NULL value is encountered?

a) IFNULL
b) COALESCE
c) NULLIF
d) DEFAULT

Correct Answer: b) COALESCE

Explanation: The COALESCE function returns the first non-NULL value in a list, allowing for default values in the presence of NULLs.

Question 28

What does the term ‘schema’ refer to in a database?

a) The physical storage of data
b) The overall structure of the database
c) The data types of columns
d) The user privileges

Correct Answer: b) The overall structure of the database

Explanation: A schema defines the structure of a database, including tables, columns, data types, and relationships.

Question 29

Which SQL command is used to grant a user read-only access to a table?

a) GRANT SELECT
b) GRANT READ
c) GRANT ALL
d) GRANT WRITE

Correct Answer: a) GRANT SELECT

Explanation: The GRANT SELECT command is used to provide a user with permission to read data from a specific table without allowing modifications.

Question 30

Which SQL keyword is used to specify the data type of a column in a table?

a) TYPE
b) DATA TYPE
c) COLUMN TYPE
d) DATA

Correct Answer: b) DATA TYPE

Explanation: The DATA TYPE specifies the type of data that can be stored in a column, such as INTEGER, VARCHAR, DATE, etc.

Question 31

Which SQL command is used to create a new table with specified columns and data types?

a) CREATE TABLE
b) ADD TABLE
c) NEW TABLE
d) DEFINE TABLE

Correct Answer: a) CREATE TABLE

Explanation: The CREATE TABLE command is used to define a new table and its columns within the database.

Question 32

Which SQL statement is used to modify the values of a specific column in existing records?

a) UPDATE
b) CHANGE
c) MODIFY
d) ALTER

Correct Answer: a) UPDATE

Explanation: The UPDATE statement is used to change the values of one or more columns in existing records based on specified conditions.

Question 33

Which SQL function is used to remove leading and trailing spaces from a string?

a) TRIM()
b) CLEAN()
c) STRIP()
d) REMOVE()

Correct Answer: a) TRIM()

Explanation: The TRIM() function removes leading and trailing whitespace from a string in SQL.

Question 34

What is the purpose of the HAVING clause in SQL?

a) To filter records before grouping
b) To sort the result set
c) To filter records after grouping
d) To join multiple tables

Correct Answer: c) To filter records after grouping

Explanation: The HAVING clause is used to filter results after aggregation has taken place, allowing conditions on grouped data.

Question 35

Which SQL statement is used to remove a row from a table?

a) DROP
b) REMOVE
c) DELETE
d) TRUNCATE

Correct Answer: c) DELETE

Explanation: The DELETE statement is used to remove specific rows from a table based on defined conditions.

Question 36

What does the SQL function LCASE() do?

a) Converts a string to uppercase
b) Removes spaces from a string
c) Converts a string to lowercase
d) Counts characters in a string

Correct Answer: c) Converts a string to lowercase

Explanation: The LCASE() function converts all uppercase characters in a string to lowercase.

Question 37

Which SQL operator is used to compare two values for equality?

a) =
b) <>
c) !=
d) IS

Correct Answer: a) =

Explanation: The equal sign (=) is the operator used to compare two values for equality in SQL.

Question 38

Which SQL command is used to remove a column from a table?

a) DROP COLUMN
b) REMOVE COLUMN
c) DELETE COLUMN
d) ALTER COLUMN

Correct Answer: a) DROP COLUMN

Explanation: The DROP COLUMN statement is used to remove a specified column from an existing table.

Question 39

What is the purpose of a data dictionary in a database?

a) To store user data
b) To define user permissions
c) To describe database structure and objects
d) To keep track of transactions

Correct Answer: c) To describe database structure and objects

Explanation: A data dictionary contains metadata about the database structure, including details about tables, columns, indexes, and constraints.

Question 40

Which SQL command is used to create a new user in the database?

a) CREATE USER
b) ADD USER
c) NEW USER
d) DEFINE USER

Correct Answer: a) CREATE USER

Explanation: The CREATE USER command establishes a new user account in the database management system.

Complete the Captcha to view next question set.

Prev Post
WGU D426 Practice Exam Questions – Set 4 – Part 1
Next Post
WGU D426 Practice Exam Questions – Set 4 – Part 3