OA Exams

  • California, TX 70240
  • Info@gmail.com
  • Office Hours: 8:00 AM – 7:45 PM
  • web.groovymark@gmail.com
  • October 25, 2024

Question 01

Which SQL command is used to remove a database entirely, including all its tables?

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

Correct Answer: a) DROP DATABASE

Explanation: The DROP DATABASE command is used to remove a database and all its tables from the database management system.

Question 02

Which SQL statement is used to modify the structure of an existing table?

a) CREATE TABLE
b) ALTER TABLE
c) DROP TABLE
d) UPDATE TABLE

Correct Answer: b) ALTER TABLE

Explanation: The ALTER TABLE statement is used to change the structure of an existing table, such as adding or dropping columns.

Question 03

In SQL, which command is used to create a new table?

a) CREATE TABLE
b) INSERT TABLE
c) ADD TABLE
d) NEW 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 04

Which SQL clause is used to filter records after they have been grouped?

a) WHERE
b) HAVING
c) GROUP BY
d) LIMIT

Correct Answer: b) HAVING

Explanation: The HAVING clause is used to filter groups of records after the aggregation has been performed with the GROUP BY clause.

Question 05

Which SQL command is used to change data in an existing row?

a) INSERT
b) UPDATE
c) DELETE
d) MODIFY

Correct Answer: b) UPDATE

Explanation: The UPDATE command is used to modify existing records in a table based on specified conditions.

Question 06

What is the purpose of a primary key in a database?

a) To store duplicate values
b) To uniquely identify each row in a table
c) To reference another table
d) To enforce referential integrity

Correct Answer: b) To uniquely identify each row in a table

Explanation: A primary key uniquely identifies each row in a table, ensuring that no two rows have the same value in the primary key column(s).

Question 07

Which SQL function is used to retrieve the minimum value from a column?

a) MIN()
b) MAX()
c) AVG()
d) SUM()

Correct Answer: a) MIN()

Explanation: The MIN() function returns the smallest value from a specified column in SQL.

Question 08

Which type of join returns only the rows that have matching values in both tables?

a) INNER JOIN
b) LEFT JOIN
c) RIGHT JOIN
d) FULL JOIN

Correct Answer: a) INNER JOIN

Explanation: An INNER JOIN returns only the rows that have matching values in both tables involved in the join.

Question 09

Which SQL statement is used to remove all rows from a table but keep the structure intact?

a) DELETE
b) TRUNCATE
c) DROP TABLE
d) CLEAR

Correct Answer: b) TRUNCATE

Explanation: The TRUNCATE command removes all rows from a table without affecting the table's structure.

Question 10

What does the SQL keyword UNIQUE ensure for a column?

a) Values can be duplicated
b) Values must be unique across the column
c) Values can be NULL
d) Values must be the same as another column

Correct Answer: b) Values must be unique across the column

Explanation: The UNIQUE constraint ensures that all values in a specified column are distinct from each other.

Question 11

Which SQL operator is used to compare a value against a list of values?

a) LIKE
b) IN
c) BETWEEN
d) EXISTS

Correct Answer: b) IN

Explanation: The IN operator is used to determine if a value matches any value in a specified list.

Question 12

Which clause is used to specify the column names when creating a table?

a) SET
b) COLUMN
c) CREATE
d) AS

Correct Answer: c) CREATE

Explanation: The CREATE command is followed by the specification of column names and their data types when creating a new table.

Question 13

In SQL, which function returns the current date and time?

a) CURDATE()
b) NOW()
c) GETDATE()
d) DATE()

Correct Answer: b) NOW()

Explanation: The NOW() function retrieves the current date and time from the system clock.

Question 14

Which SQL statement is used to create a view?

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

Correct Answer: a) CREATE VIEW

Explanation: The CREATE VIEW statement is used to define a new view based on a SELECT query, allowing for simplified data retrieval.

Question 15

Which SQL clause is used to sort the result set in ascending order?

a) ORDER BY
b) GROUP BY
c) SORT BY
d) LIMIT

Correct Answer: a) ORDER BY

Explanation: The ORDER BY clause sorts the result set based on one or more columns in ascending order by default.

Question 16

What is the main function of a foreign key in a database?

a) To enforce data integrity
b) To store large objects
c) To retrieve data quickly
d) To ensure unique values

Correct Answer: a) To enforce data integrity

Explanation: A foreign key establishes a link between two tables, ensuring that the data remains consistent and valid.

Question 17

Which SQL function is used to calculate the average of a set of values?

a) AVG()
b) SUM()
c) COUNT()
d) MEDIAN()

Correct Answer: a) AVG()

Explanation: The AVG() function computes the average value of a specified column in SQL.

Question 18

Which SQL clause filters records before any grouping is applied?

a) WHERE
b) HAVING
c) GROUP BY
d) ORDER BY

Correct Answer: a) WHERE

Explanation: The WHERE clause is applied to filter rows before they are grouped in a GROUP BY operation.

Question 19

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

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

Correct Answer: a) CREATE USER

Explanation: The CREATE USER command is used to establish a new user account in the database management system.

Question 20

Which SQL statement is used to update values in a table?

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

Correct Answer: c) UPDATE

Explanation: The UPDATE statement is used to modify existing records in a table.

Complete the Captcha to view next question set.

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