FREE Data Warehousing on AWS: SQL Questions and Answers

0%

Which SQL statement is employed when fresh data is to be added to a database?

Correct! Wrong!

Using SQL, you can insert new data (rows or records) into a database table by using the "INSERT INTO" statement.
A key SQL command that enables you to add new data to a particular table is the INSERT INTO statement.

Which SQL query is employed to only return distinct values?

Correct! Wrong!

The "SELECT DISTINCT" query in SQL is used to only return distinct (unique) values from a column or set of columns in a table.
The only unique values are returned by this query, which eliminates duplicate rows.

How do you delete data from a database using SQL?

Correct! Wrong!

The "DELETE" statement in SQL is used to remove data from a database.
A basic SQL command that lets you delete rows or records from a database table is the DELETE statement.

How do you use SQL to retrieve every record from a table called "Persons" where the "LastName" is between (and includes) "Hansen" and "Pettersen" alphabetically?

Correct! Wrong!

You can use the "SELECT" statement along with the "WHERE" clause and the "BETWEEN" keyword to get every record from a table called "Persons" where the "LastName" is between (and includes) "Hansen" and "Pettersen" alphabetically.

How does one update data in a database using SQL?

Correct! Wrong!

The "UPDATE" statement in SQL is used to modify data in a database.
An essential SQL command that lets you edit already-existing records in a database table is the UPDATE statement.

Which SQL command is employed to retrieve data from a database?

Correct! Wrong!

The "SELECT" statement is the SQL command used to get data out of a database.
One of the most fundamental and frequently used SQL statements is the SELECT statement.
You are able to provide both the tables and the columns from which you want to obtain data.

How do you use SQL to retrieve every record where Peter is the first name and Jackson is the last name from the "Persons" table?

Correct! Wrong!

You use the "SELECT" statement with the "WHERE" clause to define the conditions for both the first name and last name to extract every entry from the "Persons" table where the first name is "Peter" and the last name is "Jackson."

Which SQL query is employed to only return distinct values?

Correct! Wrong!

When a query is run, the "ORDER BY" phrase in SQL is used to describe how the result set should be sorted.
It is used for sorting purposes rather than to return distinct values.

How do you use SQL to pick every record from the "Persons" table where the value of the "FirstName" column begins with a "a"?

Correct! Wrong!

You can use the "SELECT" statement along with the "WHERE" clause, the "LIKE" keyword, and the "Persons" table to select all records where the value of the "FirstName" column starts with the letter "a." In order to match any character that fits the supplied pattern, the wildcard symbol % is utilized.

What exactly does SQL mean?

Correct! Wrong!

Structured Query Language, or SQL, is a query language.
It is a special language for maintaining and programming relational databases.
A relational database management system's data can be accessed, changed, and managed using SQL (RDBMS).

How can you use SQL to return every record from a "Persons" table ordered by "FirstName"?

Correct! Wrong!

The "SELECT * FROM Persons ORDER BY FirstName DESC;" statement is the proper technique to retrieve every record from a "Persons" table with the "FirstName" column listed in descending order.
This obtains all columns for rows that are arranged descendingly depending on the chosen column.

If ANY of the listed conditions are true, the OR operator displays a record. If ALL of the specified criteria are true, the AND operator displays a record.

Correct! Wrong!

The assertion is true.
In the WHERE clause of a query, numerous conditions can be combined using the "OR" and "AND" operators in SQL.

How do you use SQL to select every column from the "Persons" table?

Correct! Wrong!

utilizing the "SELECT * FROM Persons;" command is the proper SQL syntax for choosing every column from the "Persons" table.
With this, every column for every row in the table is retrieved.

How do you use SQL to retrieve every record from the "Persons" table when "Peter" is the value of the "FirstName" column?

Correct! Wrong!

The "SELECT * FROM Persons WHERE FirstName='Peter';" command is the one to use if you want to get every record from the "Persons" table that has "Peter" in the "FirstName" column.
When a row meets the required criterion, this fetches all columns for that row.

How do you add a new record using SQL to the "Persons" table?

Correct! Wrong!

The "INSERT INTO Persons VALUES" SQL statement, as displayed in option c, is the proper approach to insert a new record into the "Persons" table.
The values that are supplied are inserted into the table's relevant columns by this statement.

How do you use SQL to choose the "FirstName" column from the "Persons" table?

Correct! Wrong!

The SQL query "SELECT FirstName FROM Persons;" is the one to use in order to select the "FirstName" column from the "Persons" table.
This retrieves the values for each row in the table for the specified column.

Premium Tests $49/mo
FREE December-2024