Sunteți pe pagina 1din 4

Republic of the Philippines BATANES STATE COLLEGE Basco, Batanes MIDTERM EXAMINATION ITE 22 (IT Elective Current and

Future Trends) Name: ______________________________ Course&Level: ________________________ I. Score: ______________ Date: ______________

Multiple Choice: Instructions: Encircle the letter of your choice that best corresponds to your answer.

1. What does SQL stands for? a. Strong Question Language b. Structured Question Language c. Structured Query Language d. Strong Query Language

2. Which SQL statement is used to extract data from a database? a. Open b. Extract c. Get d. Select

3. Which SQL statement is used to update data in a database? a. Modify b. Save as c. Save d. Update

4. Which SQL statement is used to delete data from a database? a. Remove b. Collapse c. Delete d. Erase

5. Which SQL statement is used to insert new data in a database? a. Add new b. Add record c. Insert new d. Insert into

6. With SQL, how do you select a column named "FirstName" from a table named "Persons"? a. SELECT FirstName FROM Persons b. SELECT Persons.FirstName c. EXTRACT FirstName FROM Persons d. ChOOSE FirtsName FROM Persons

7. With SQL, how do you select all the columns from a table named "Persons"? a. SELECT Persons b. SELECT *.Persons c. SELECT [all] FROM Persons d. SELECT * FROM Persons

Pen is mightier than Sword. Jose P. Rizal

Republic of the Philippines BATANES STATE COLLEGE Basco, Batanes 8. With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"? a. b. c. d. SELECT * FROM Persons WHERE FirstName='Peter' SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter' SELECT [all] FROM Persons WHERE FirstName='Peter' SELECT * FROM Persons WHERE FirstName<>'Peter'

9. With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"? a. b. c. d. SELECT * FROM Persons WHERE FirstName LIKE '%a' SELECT * FROM Persons WHERE FirstName='a' SELECT * FROM Persons WHERE FirstName='%a%' SELECT * FROM Persons WHERE FirstName LIKE 'a%'

10. With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"? a. b. c. d. SELECT FirstName='Peter', LastName='Jackson' FROM Persons SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson' SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson' SELECT Peter, Jackson FROM Persons

11. With SQL, how do you select all the records from a table named "Persons" where the "LastName" is alphabetically between (and including) "Hansen" and "Pettersen"? a. b. c. d. SELECT LastName>'Hansen' AND LastName<'Pettersen' FROM Persons SELECT * FROM Persons WHERE LastName BETWEEN 'Hansen' AND 'Pettersen' SELECT * FROM Persons WHERE LastName>'Hansen' AND LastName<'Pettersen' SELECT LastName FROM Person BETWEEN Hansen AND Pettersen

12. Which SQL statement is used to return only different values? a. b. c. d. SELECT DIFFERENT SELECT UNIQUE SELECT DISTINCT SELECT RETURN

13. Which SQL keyword is used to sort the result-set? a. b. c. d. SORT BY SORT ORDER ORDER BY

Pen is mightier than Sword. Jose P. Rizal

Republic of the Philippines BATANES STATE COLLEGE Basco, Batanes 14. With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"? a. b. c. d. SELECT * FROM Persons SORT BY 'FirstName' DESC SELECT * FROM Persons ORDER BY FirstName DESC SELECT * FROM Persons ORDER FirstName DESC SELECT * FROM Persons SORT 'FirstName' DESC

15. With SQL, how can you insert a new record into the "Persons" table? a. b. c. d. INSERT VALUES ('Jimmy', 'Jackson') INTO Persons INSERT INTO Persons VALUES ('Jimmy', 'Jackson') INSERT ('Jimmy', 'Jackson') INTO Persons INSERT INTO Persons (Jimmy,Jackson)

16. With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table? a. b. c. d. INSERT ('Olsen') INTO Persons (LastName) INSERT INTO Persons ('Olsen') INTO LastName INSERT INTO Persons (LastName) VALUES ('Olsen') INSERT Olsen INTO LastName INTO Persons

17. How can you change "Hansen" into "Nilsen" in the "LastName" column in the Persons table? a. b. c. d. MODIFY Persons SET LastName='Nilsen' WHERE LastName='Hansen' UPDATE Persons SET LastName='Hansen' INTO LastName='Nilsen' MODIFY Persons SET LastName='Hansen' INTO LastName='Nilsen UPDATE Persons SET LastName='Nilsen' WHERE LastName='Hansen'

18. With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table? a. b. c. d. DELETE FROM Persons WHERE FirstName = 'Peter' DELETE ROW FirstName='Peter' FROM Persons DELETE FirstName='Peter' FROM Persons DELETE Peter FROM Persons

19. With SQL, how can you return the number of records in the "Persons" table? a. b. c. d. SELECT COLUMNS() FROM Persons SELECT COLUMNS(*) FROM Persons SELECT COUNT(*) FROM Persons SELECT COUNT() FROM Persons

Pen is mightier than Sword. Jose P. Rizal

Republic of the Philippines BATANES STATE COLLEGE Basco, Batanes 20. With SQL, how do you select the records from a table named "Persons" where the "LastName" is equal to Svendson and the first name is equal to "Tove" or to "Ola"? a. SELECT * FROM Persons WHERE LastName='Svendson' AND (FirstName='Tove' OR FirstName='Ola') b. SELECT LastName='Svendson' AND (FirstName='Tove' OR FirstName='Ola') FROM Persons c. SELECT Svendson, Tove, Ola * FROM Persons d. SELECT * FROM Persons WHERE LastName=Svendson AND (FirstName=Tove OR FirstName=Ola) II. Identification Instructions: Given the table named Company, provide the output of the following SQL statement below.

CompanyName Tindahan ni Aling Nena Kapihan kay Mang Jose Nenes Sari-sari Store Turos Turo-turo Tolomes Car wash

ContactName Nena Jose Batumbakal Ma. Angela Santos Arturo Jose Bartolome

Address Kaychanarianan Kayvaluganan Kayhuvukan Kayvaluganan Kaychanarianan

City Basco Basco Basco Basco Basco

1. SELECT CompanyName, Address FROM Company 2. SELECT * FROM Company WHERE companyname LIKE 'T%' 3. SELECT CompanyName, ContactName FROM Company WHERE CompanyName > 't'

Pen is mightier than Sword. Jose P. Rizal

S-ar putea să vă placă și