CS计算机代考程序代写 SQL database DTA(M) Database Theory & Applications

DTA(M) Database Theory & Applications

Quiz: Basic SQL

1. What does SQL stand for?

Structured Query Language

Strong Question Language

Structured Question Language

2. Which SQL statement is used to extract data from a database?

SELECT

GET

OPEN

EXTRACT

3. Which SQL statement is used to update data in a database?

UPDATE

SAVE

MODIFY

SAVE AS

4. Which SQL statement is used to delete data from a database?

DELETE

COLLAPSE

REMOVE

5. Which SQL statement is used to insert new data in a database?

INSERT INTO

INSERT NEW

ADD NEW

ADD RECORD

6. With SQL, how do you select a column named “FirstName” from a table named “EMPLOYEE”?

SELECT FirstName FROM EMPLOYEE

SELECT EMPLOYEE.FirstName

EXTRACT FirstName FROM EMPLOYEE

DTA(M) Database Theory & Applications

7. With SQL, how do you select all the columns from a table named “EMPLOYEE”?

SELECT * FROM EMPLOYEE

SELECT [all] FROM EMPLOYEE

SELECT *.EMPLOYEE

SELECT EMPLOYEE

8. With SQL, how do you select all the records from a table named ” EMPLOYEE” where the value of
the column “FirstName” is “Peter”?

SELECT * FROM EMPLOYEE WHERE FirstName=’Peter’

SELECT [all] FROM EMPLOYEE WHERE FirstName=’Peter’

SELECT * FROM EMPLOYEE WHERE FirstName<>‘Peter’

SELECT [all] FROM EMPLOYEE WHERE FirstName LIKE ‘Peter’

9. With SQL, how do you select all the records from a table named ” EMPLOYEE” where the value of
the column “FirstName” starts with an “a”?

SELECT * FROM EMPLOYEE WHERE FirstName LIKE ‘a%’

SELECT * FROM EMPLOYEE WHERE FirstName=’%a%’

SELECT * FROM EMPLOYEE WHERE FirstName LIKE ‘%a’

SELECT * FROM EMPLOYEE WHERE FirstName=’a’

10. The OR operator displays a record if ANY conditions listed are true. The AND operator displays a
record if ALL of the conditions listed are true

True

False

11. With SQL, how do you select all the records from a table named ” EMPLOYEE” where the
“FirstName” is “Peter” and the “LastName” is “Jackson”?

SELECT * FROM EMPLOYEE WHERE FirstName=’Peter’ AND LastName=’Jackson’

SELECT FirstName=’Peter’, LastName=’Jackson’ FROM EMPLOYEE

SELECT * FROM EMPLOYEE WHERE FirstName<>‘Peter’ AND LastName<>‘Jackson’

12. With SQL, how do you select all the records from a table named ” EMPLOYEE” where the
“LastName” is alphabetically between (and including) “Hansen” and “Pettersen”?

SELECT * FROM EMPLOYEE WHERE LastName BETWEEN ‘Hansen’ AND ‘Pettersen’

SELECT * FROM EMPLOYEE WHERE LastName>’Hansen’ AND LastName<'Pettersen' SELECT LastName>‘Hansen’ AND LastName<'Pettersen' FROM EMPLOYEE DTA(M) Database Theory & Applications 13. Which SQL statement is used to return only different values? SELECT DISTINCT SELECT DIFFERENT SELECT UNIQUE 14. Which SQL keyword is used to sort the result-set? ORDER BY ORDER SORT SORT BY 15. With SQL, how can you return all the records from a table named " EMPLOYEE" sorted descending by "FirstName"? SELECT * FROM EMPLOYEE ORDER BY FirstName DESC SELECT * FROM EMPLOYEE ORDER FirstName DESC SELECT * FROM EMPLOYEE SORT 'FirstName' DESC SELECT * FROM EMPLOYEE SORT BY 'FirstName' DESC 16. With SQL, how can you insert a new record into the " EMPLOYEE" table? INSERT INTO EMPLOYEE VALUES ('Jimmy', 'Jackson') INSERT VALUES ('Jimmy', 'Jackson') INTO EMPLOYEE INSERT ('Jimmy', 'Jackson') INTO EMPLOYEE 17. With SQL, how can you insert "Olsen" as the "LastName" in the " EMPLOYEE" table? INSERT INTO EMPLOYEE (LastName) VALUES ('Olsen') INSERT ('Olsen') INTO EMPLOYEE (LastName) INSERT INTO EMPLOYEE ('Olsen') INTO LastName 18. How can you change "Hansen" into "Nilsen" in the "LastName" column in the EMPLOYEE table? UPDATE EMPLOYEE SET LastName='Nilsen' WHERE LastName='Hansen' UPDATE EMPLOYEE SET LastName='Hansen' INTO LastName='Nilsen' MODIFY EMPLOYEE SET LastName='Hansen' INTO LastName='Nilsen MODIFY EMPLOYEE SET LastName='Nilsen' WHERE LastName='Hansen' DTA(M) Database Theory & Applications 19. With SQL, how can you delete the records where the "FirstName" is "Peter" in the EMPLOYEE Table? DELETE FROM EMPLOYEE WHERE FirstName = 'Peter' DELETE ROW FirstName='Peter' FROM EMPLOYEE DELETE FirstName='Peter' FROM EMPLOYEE 20. With SQL, how can you return the number of records in the " EMPLOYEE" table? SELECT COUNT(*) FROM EMPLOYEE SELECT LEN(*) FROM EMPLOYEE SELECT NO(*) FROM EMPLOYEE SELECT COLUMNS(*) FROM EMPLOYEE 21. What is the most common type of join? INNER JOIN INSIDE JOIN JOINED JOINED TABLE 22. Which operator is used to select values within a range? BETWEEN WITHIN RANGE 23. The NOT NULL constraint enforces a column to not accept NULL values. True False 24. Which operator is used to search for a specified pattern in a column? LIKE FROM GET 25. Which SQL statement is used to create a database table called 'Customers'? CREATE TABLE Customers CREATE DATABASE TAB Customers CREATE DB Customers CREATE DATABASE TABLE Customers