Саволномаи зерин иборат аз 25 савол буда, барои санҷидани дониш аз SQL тартиб дода шудааст.

Дар саволҳои 1-10 ҷадвали зерин истифода карда шавад:

Ҷадвали BOOK_INFORMATION

Майдон
BOOK_ID
BOOK_TITLE
PRICE

1. Which SQL statement would you use to select all columns from the BOOK_INFORMATION table?

1. Барои интихоб намудани ҳамаи майдонҳои (сутунҳои) ҷадвали BOOK_INFORMATION кадоме аз фармонҳои зерини SQL истифода мешавад?

a) SELECT BOOK_ID + PRICE FROM BOOK_INFORMATION;
b) SELECT * FROM BOOK_INFORMATION;
c) SELECT ALL FROM BOOK_INFORMATION;
d) SELECT ALL COLUMNS FROM BOOK_INFORMATION;


2. Which SQL statement would you use to select all books that has a price higher than 20?

2. Барои интихоб намудани ҳамаи китобҳои нархашон аз 20 калон аз кадоме аз фармонҳои зерини SQL истифода мешавад?

a) SELECT BOOK_ID FROM BOOK_INFORMATION HAVING PRICE > 20;
b) SELECT BOOK_ID FROM BOOK_INFORMATION ONLY PRICE > 20;
c) SELECT BOOK_ID FROM BOOK_INFORMATION WHERE BOOK_ID > 20;
d) SELECT BOOK_ID FROM BOOK_INFORMATION WHERE PRICE > 20;


3. Which SQL statement would you use to select all books whose title starts with 'A'?

3. Барои интихоб намудани ҳамаи китобҳое, ки номашон бо ҳарфи 'A' оғоз меёбад, кадоме аз фармонҳои зерини SQL истифода мешавад?

a) SELECT BOOK_ID, BOOK_TITLE FROM BOOK_INFORMATION WHERE BOOK_TITLE LIKE 'A';
b) SELECT BOOK_ID, BOOK_TITLE FROM BOOK_INFORMATION WHERE BOOK_TITLE IN 'A';
c) SELECT BOOK_ID, BOOK_TITLE FROM BOOK_INFORMATION WHERE BOOK_TITLE LIKE 'A%';
d) SELECT BOOK_ID, BOOK_TITLE FROM BOOK_INFORMATION WHERE BOOK_TITLE LIKE '%A';


4. Which SQL statement allows you to sort all books by price, from the highest price to lowest price?

4. Кадоме аз фармонҳои зерини SQL барои ба тартиб овардани рӯйхати китобҳо аз рӯи нархашон ба тариқи камшавӣ (аз баландтарин нарх то пасттарин) истифода мешавад?

a) SELECT BOOK_ID, BOOK_TITLE, PRICE FROM BOOK_INFORMATION ORDER BY PRICE DESC;
b) SELECT BOOK_ID, BOOK_TITLE, PRICE FROM BOOK_INFORMATION SORT BY PRICE DESC;
c) SELECT BOOK_ID, BOOK_TITLE, PRICE FROM BOOK_INFORMATION SORT BY PRICE ASC;
d) SELECT BOOK_ID, BOOK_TITLE, PRICE FROM BOOK_INFORMATION ORDER BY PRICE ASC;


5. Which SQL statement allows you to insert the following piece of data into BOOK_INFORMATION?

5. Кадоме аз фармонҳои зерини SQL ба ҷадвали BOOK_INFORMATION маълумоти зеринро сабт мекунад?
    BOOK_ID=20
    BOOK_TITLE='1KEYDATA SQL TUTORIAL'
    PRICE=15

a) ADD INTO BOOK_INFORMATION WITH (20,'1KEYDATA SQL TUTORIAL',15);
b) INSERT INTO BOOK_INFORMATION USING (20,'1KEYDATA SQL TUTORIAL',15);
c) INSERT INTO BOOK_INFORMATION VALUES (20,'1KEYDATA SQL TUTORIAL',15);
d) ADD INTO BOOK_INFORMATION VALUES (20,'1KEYDATA SQL TUTORIAL',15);


6. Which SQL statement lets you remove the table BOOK_INFORMATION from the database?

6. Кадоме аз фармонҳои зерини SQL ҷадвали BOOK_INFORMATION-ро хориҷ (нест) мекунад?

a) DROP BOOK_INFORMATION;
b) DELETE TABLE BOOK_INFORMATION;
c) TRUNCATE TABLE BOOK_INFORMATION;
d) DROP TABLE BOOK_INFORMATION;


7. Which SQL statement would you use to delete the row for BOOK_ID=15?

7. Кадоме аз фармонҳои зерини SQL барои хориҷ (нест) намудани сабти BOOK_ID=15 дуруст аст?

a) TRUNCATE TABLE BOOK_INFORMATION WHERE BOOK_ID = 15;
b) DELETE FROM BOOK_INFORMATION WHERE BOOK_ID = 15;
c) DROP BOOK_INFORMATION WHERE BOOK_ID = 15;
d) TRUNCATE BOOK_INFORMATION WHERE BOOK_ID = 15;


8. Which SQL statement will you use to change the price for the BOOK titled 'ELEMENTARY SCHOOL GUIDE' to 20?

8. Кадоме аз фармонҳои зерини SQL барои иваз намудани нархи китоби 'ELEMENTARY SCHOOL GUIDE' ба 20 истифода мешавад?

a) UPDATE BOOK_INFORMATION SET PRICE = 20 WHERE BOOK_TITLE = 'ELEMENTARY SCHOOL GUIDE';
b) UPDATE TABLE BOOK_INFORMATION SET PRICE = 20 WHERE BOOK_TITLE = 'ELEMENTARY SCHOOL GUIDE';
c) UPDATE BOOK_INFORMATION CHANGE PRICE = 20 WHERE BOOK_TITLE = 'ELEMENTARY SCHOOL GUIDE';
d) UPDATE TABLE BOOK_INFORMATION SET PRICE = 20 WHERE BOOK_ID = 'ELEMENTARY SCHOOL GUIDE';


9. Which SQL statement allows you to find the highest price from the table BOOK_INFORMATION?

9. Кадоме аз фармонҳои зерини SQL барои муайян намудани нархи калонтарин дар ҷадвали BOOK_INFORMATION истифода мешавад?

a) SELECT BOOK_ID, BOOK_TITLE, MAX(PRICE) FROM BOOK_INFORMATION;
b) SELECT MAX(PRICE) FROM BOOK_INFORMATION;
c) SELECT MAXIMUM(PRICE) FROM BOOK_INFORMATION;
d) SELECT PRICE FROM BOOK_INFORMATION ORDER BY PRICE DESC;


10. Which SQL statement allows you to find all books priced between 15 and 20?

10. Кадоме аз фармонҳои зерини SQL барои ёфтани ҳамаи китобҳои нархашон аз 15 то 20 истифода мешавад?

a) SELECT BOOK_ID, BOOK_TITLE, PRICE FROM BOOK_INFORMATION WHERE PRICE IS BETWEEN 15 AND 20;
b) SELECT BOOK_ID, BOOK_TITLE, PRICE FROM BOOK_INFORMATION HAVING PRICE IS BETWEEN 15 AND 20;
c) SELECT BOOK_ID, BOOK_TITLE, PRICE FROM BOOK_INFORMATION WHERE PRICE BETWEEN 15 AND 20;
d) SELECT BOOK_ID, BOOK_TITLE, PRICE FROM BOOK_INFORMATION HAVING PRICE BETWEEN 15 AND 20;


Questions 11 - 15 uses the following table:

Саволҳои 11 - 15 ҷадвали зеринро истифода мебаранд:

Ҷадвали SALES

Column Name
STORE_ID
SALES_DATE
SALES_AMOUNT

11. Which SQL statement lets you find the sales amount for each store?

11. Кадоме аз фармонҳои зерини SQL барои ҳар як мағоза (store) миқдори китобҳои фурӯхташударо муайян менамояд?

a) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES;
b) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES ORDER BY STORE_ID;
c) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES GROUP BY STORE_ID;
d) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES HAVING UNIQUE STORE_ID;


12. Which SQL statement lets you list all stores whose total sales amount is over 5000?

12. Кадоме аз фармонҳои зерини SQL барои сохтани рӯйхати ҳамаи мағозаҳое (store), ки миқдори умумии фурӯшашон аз 5000 зиёд аст, истифода мешавад?

a) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES GROUP BY STORE_ID HAVING SUM(SALES_AMOUNT) > 5000;
b) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES GROUP BY STORE_ID HAVING SALES_AMOUNT > 5000;
c) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES WHERE SUM(SALES_AMOUNT) > 5000 GROUP BY STORE_ID;
d) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES WHERE SALES_AMOUNT > 5000 GROUP BY STORE_ID;


13. Which SQL statement is the correct one to use to find the earliest date STORE_ID 10 had a sales amount greater than 0?

13. Кадоме аз фармонҳои зерини SQL барои ёфтани санаи аввалине, ки дар он мағозаи бо STORE_ID 10 фурӯши калон аз 0 дошт, истифода мешавад?

a) SELECT MAX(SALES_DATE) FROM SALES WHERE STORE_ID = 10 AND SALES_AMOUNT > 0;
b) SELECT SALES_DATE FROM SALES WHERE STORE_ID = 10 AND SALES_AMOUNT > 0;
c) SELECT MIN(SALES_DATE) FROM SALES WHERE STORE_ID = 10 OR SALES_AMOUNT > 0;
d) SELECT MIN(SALES_DATE) FROM SALES WHERE STORE_ID = 10 AND SALES_AMOUNT > 0;


14. Which SQL statement lets you find the total number of stores in the SALES table?

14. Кадоме аз фармонҳои зерини SQL барои муайян намудани миқдори умумии мағозахо дар ҷадвали SALES истифода мешавад?

a) SELECT COUNT(STORE_ID) FROM SALES;
b) SELECT COUNT(DISTINCT STORE_ID) FROM SALES;
c) SELECT DISTINCT STORE_ID FROM SALES;
d) SELECT COUNT(STORE_ID) FROM SALES GROUP BY STORE_ID;


15. Which SQL statement allows you to find the total sales amount for Store ID 25 and the total sales amount for Store ID 45?

15. Кадоме аз фармонҳои зерини SQL барои муайян намудани миқдори умумии фурӯши китобҳо дар мағозаи 25 ва миқдори умумии фурӯши китобҳо дар мағозаи 45 истифода мешавад?

a) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES WHERE STORE_ID IN (25,45) GROUP BY STORE_ID;
b) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES GROUP BY STORE_ID HAVING STORE_ID IN (25,45);
c) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES WHERE STORE_ID IN (25,45);
d) SELECT STORE_ID, SUM(SALES_AMOUNT) FROM SALES WHERE STORE_ID = 25 AND STORE_ID = 45 GROUP BY STORE_ID;


Questions 16-25 use the following table:

Саволҳои 16 - 25 ҷадвали зеринро истифода мебаранд:

Ҷадвали EXAM_RESULTS

STUDENT_ID FIRST_NAME LAST_NAME EXAM_ID EXAM_SCORE
10 LAURA LYNCH 1 90
10 LAURA LYNCH 2 85
11 GRACE BROWN 1 78
11 GRACE BROWN 2 72
12 JAY JACKSON 1 95
12 JAY JACKSON 2 92
13 WILLIAM BISHOP 1 70
13 WILLIAM BISHOP 2 100
14 CHARLES PRADA 2 85

16. What is the result of the following SQL statement:
SELECT COUNT(DISTINCT STUDENT_ID) FROM EXAM_RESULTS;

16. Натиҷаи фармони зерини SQL чист? :
SELECT COUNT(DISTINCT STUDENT_ID) FROM EXAM_RESULTS;

a) 3
b) 4
c) 5
d) 6


17. What SQL statement do we use to find the average exam score for EXAM_ID = 1?

17. Кадоме аз фармонҳои зерини SQL барои муайян намудани қимати миёнаи баҳоҳои азони EXAM_ID = 1 истифода мешавад?

a) SELECT AVG(EXAM_SCORE) FROM EXAM_RESULTS;
b) SELECT AVG(EXAM_SCORE) FROM EXAM_RESULTS WHERE EXAM_ID = 1;
c) SELECT AVG(EXAM_SCORE) FROM EXAM_RESULTS GROUP BY EXAM_ID;
d) SELECT COUNT(EXAM_SCORE) FROM EXAM_RESULTS WHERE EXAM_ID = 1;


18. Which SQL statement do we use to find out how many students took each exam?

18. Кадоме аз фармонҳои зерини SQL барои муайян намудани он ки ҳар як имтиҳонро чанд донишҷӯ супоридааст истифода мешавад?

a) SELECT COUNT(DISTINCT Stduetn_ID) FROM EXAM_RESULTS GROUP BY EXAM_ID;
b) SELECT EXAM_ID, MAX(STUDENT_ID) FROM EXAM_RESULTS GROUP BY EXAM_ID;
c) SELECT EXAM_ID, COUNT(DISTINCT STUDENT_ID) FROM EXAM_RESULTS GROUP BY EXAM_ID;
d) SELECT EXAM_ID, MIN(STUDENT_ID) FROM EXAM_RESULTS GROUP BY EXAM_ID;


19. What SQL statement do we use to print out the record of all students whose last name starts with 'L'?

19. Кадоме аз фармонҳои зерини SQL барои чоп намудани сабтҳои ҳамаи донишҷӯёне, ки фамилияашон (last name) бо ҳарфи 'L' оғоз меёбанд, истифода мешавад?

a) SELECT * FROM EXAM_RESULTS WHERE LAST_NAME LIKE 'L%';
b) SELECT * FROM EXAM_RESULTS WHERE LAST_NAME LIKE 'L';
c) SELECT * FROM EXAM_RESULTS WHERE LAST_NAME = 'L';
d) SELECT * FROM EXAM_RESULTS WHERE LAST_NAME <> 'L';


20. What is the result of the following SQL statement:
SELECT MAX(EXAM_SCORE) FROM EXAM_RESULTS WHERE EXAM_ID = 1 AND FIRST_NAME LIKE '%E%';

20. Натиҷаи фармони зерини SQL чист? :
SELECT MAX(EXAM_SCORE) FROM EXAM_RESULTS WHERE EXAM_ID = 1 AND FIRST_NAME LIKE '%E%';

a) 90
b) 85
c) 100
d) 78


21. What SQL statement do we use to print out the records of all students whose first name or last name ends in 'A'?

21. Кадоме аз фармонҳои зерини SQL барои чоп намудани сабтҳои ҳамаи донишҷӯёне, ки номашон (first name) ё фамилияашон (last name) бо ҳарфи 'A' тамом шудааст, истифода мешавад?

a) SELECT * FROM EXAM_RESULTS WHERE FIRST_NAME LIKE '%A' OR LAST_NAME LIKE '%A';
b) SELECT * FROM EXAM_RESULTS WHERE FIRST_NAME LIKE 'A' OR LAST_NAME LIKE 'A';
c) SELECT * FROM EXAM_RESULTS WHERE FIRST_NAME LIKE 'A%' OR LAST_NAME LIKE 'A%';
d) SELECT * FROM EXAM_RESULTS WHERE FIRST_NAME LIKE '%A%' OR LAST_NAME LIKE '%A%';


22. What SQL statement do we use to find the name of all students who scored better than 90 on the second exam (EXAM_ID = 2)?

22. Кадоме аз фармонҳои зерини SQL барои ёфтани номи ҳамаи донишҷӯёне, ки дар имтиҳони дуюм (EXAM_ID = 2) зиёда аз 90 балл гирифтаанд, истифода мешавад?

a) SELECT FIRST_NAME, LAST_NAME FROM EXAM_RESULTS WHERE EXAM_ID = 2 OR Exam_SCORE > 90;
b) SELECT FIRST_NAME, LAST_NAME FROM EXAM_RESULTS WHERE EXAM_ID = 2 AND Exam_SCORE > 90;
c) SELECT FIRST_NAME, LAST_NAME FROM EXAM_RESULTS WHERE Exam_SCORE > 90;
d) SELECT FIRST_NAME, LAST_NAME FROM EXAM_RESULTS WHERE EXAM_ID = 2 HAVING Exam_SCORE > 90;


23. What SQL statement do we use to find the name of all students who scored better than 180 on all the Exams?

23. Кадоме аз фармонҳои зерини SQL барои ёфтани номи ҳамаи донишҷӯёне, ки дар ҳамаи имтиҳонҳо зиёда аз 180 балл гирифтаанд, истифода мешавад?

a) SELECT FIRST_NAME, LAST_NAME, SUM(EXAM_SCORE) FROM EXAM_RESULTS GROUP BY FIRST_NAME, LAST_NAME;
b) SELECT FIRST_NAME, LAST_NAME, SUM(EXAM_SCORE) FROM EXAM_RESULTS HAVING SUM(EXAM_SCORE) > 180;
c) SELECT FIRST_NAME, LAST_NAME, SUM(EXAM_SCORE) FROM EXAM_RESULTS GROUP BY FIRST_NAME, LAST_NAME HAVING SUM(EXAM_SCORE) > 180;
d) SELECT FIRST_NAME, LAST_NAME, SUM(EXAM_SCORE) FROM EXAM_RESULTS WHERE EXAM_SCORE > 180 GROUP BY FIRST_NAME, LAST_NAME;


24. How many records does the following SQL statement generate?
SELECT * FROM EXAM_RESULTS WHERE LAST_NAME LIKE '%N%' AND EXAM_SCORE > 88;

24. Натиҷаи фармони зерини SQL чанд сабт мешавад?
SELECT * FROM EXAM_RESULTS WHERE LAST_NAME LIKE '%N%' AND EXAM_SCORE > 88;

a) 4
b) 3
c) 1
d) No Result


25. How many records does the following SQL statement return?
SELECT * FROM EXAM_RESULTS WHERE STUDENT_ID <= 12 AND EXAM_SCORE > 85;

25. Натиҷаи фармони зерини SQL чанд сабт мешавад?
SELECT * FROM EXAM_RESULTS WHERE STUDENT_ID <= 12 AND EXAM_SCORE > 85;

a) 5
b) 4
c) 3
d) 2