# [25/4/2023] Tech practices (SQL) ### Q1 Which is the correct order in an SQL SELECT statement? - [ ] SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING - [ ] SELECT, FROM, GROUP BY, HAVING, WHERE, ORDER BY - [x] SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY - [ ] SELECT, FROM, GROUP BY, HAVING, ORDER BY, WHERE ### Q2 What is a view? - [ ] A view is a special stored procedure executed when certain event accurs - [x] A view is a virtual table which results of executing a pre-compiled query.A view is not part of the physical database schema, while the regular tables are. - [ ] A view is a database diagram - [ ] None of these ### Q3 Which of the following are SQL aggregate functions? - [ ] JOIN - [x] AVG - [ ] LEN - [x] SUM ### Q4 Which is the result of SQL statement `SELECT SUBSTR('123456789', INSTR('abcabcabc', 'b'), 4) AS extractStr;`? - [ ] 6789 - [x] 2345 - [ ] 1234 - [ ] 456789 ### Q5 Which of the following functions ignore NULL values? - [ ] MAX - [ ] COUNT - [ ] SUM - [x] All of these ### Q6 What is the meaning of LIKE 'r_%' - [ ] String begins `r_` - [ ] String ends with `r_` - [x] String begins with `r` and at least 2 characters in length - [ ] String has substring `r_` int it, at any position ### Q7 Which of the following join is also called as an **inner-join**? - [ ] Non-Equijoin - [ ] Self-Join - [x] Equijoin - [ ] None of these ### Q8 Which of the following is a type of SQL constraint? - [x] PRIMARY KEY - [ ] ALTERNATE KEY - [x] FOREIGN KEY - [x] UNIQUE ### Q9 What SQL command can be used to delete a column from a table? - [ ] MODIFY TABLE tableName DROP columnName; - [ ] MODIFY TABLE tableName DROP COLUMN columnName; - [ ] ALTER TABLE tableName DROP columnName; - [x] ALTER TABLE tableName DROP COLUMN columnName; ### Q10 Table **employee** has 10 records. It has a non-NULL **salary** column which is also UNIQUE. Which is the result of the SQL statement `SELECT COUNT(*) FROM employee WHERE salary > ANY (SELECT salary FROM EMPLOYEE)`? - [ ] 10 - [x] 9 - [ ] 5 - [ ] 0