SQL quizzes

Chia sẻ: Nguyen Hoang Lam | Ngày: | Loại File: DOC | Số trang:10

lượt xem

SQL quizzes

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Tài liệu tham khảo công nghệ thông tin, phần cơ sở dữ liệu, với gần 100 câu hỏi liên quan đến SQL.

Chủ đề:

Nội dung Text: SQL quizzes

  1. The NULL SQL keyword is used to ... 1. represent a missing or unknown value. NULL in SQL represents nothing. represent positive infinity. represent negative infinity. represent 0 value. The SQL DROP TABLE clause is used to... 2. modify an existing table in a database delete a table from the database create a new table in the database What does SQL stand for? 3. Structured Query Language. Strict Query Language Standard Query Language. Strong Query Language Which 2 SQL keywords specify the sorting direction of the result set retrieved with ORDER BY clause. 4. HIGH and LOW ASC and DESC UP and DOWN Which of the following SQL clauses specifies a search condition? 5. WHERE FROM WHILE SEARCH
  2. What does the following SQL statement do: SELECT Customer, COUNT(Order) FROM Sales GROUP BY 6. Customer HAVING COUNT(Order) >5 Selects all customers from table Sales that have made more than 5 orders. Selects the total number of orders from the Sales table, if this number is greater than 5 Selects all Customers from the Sales table What is the INSERT command used for? 7. To insert data. To retrieve data. To modify data. What does the UNION operator do? 8. The UNION operator combines the results of two or more queries into a one result that includes all the rows from the queries in the union. The UNION operator behaves the same as the JOIN SQL clause. The UNION operator sorts the selected result set. Normalization is… 9. a special way of selecting data the process of adding primary key to a table the process of arranging information stored in a database in a way, which removes redundancy and ambiguity. The TRUNCATE TABLE… 10. deletes all rows from a table checks if the table has primary key specified deletes the table
  3. The JOIN is a SQL keyword used to ... 11. delete data from database table. select data from 2 or more tables related by common attribute (table column). verify that the inserted data is correct. update database table. The CREATE TABLE statement is used to… 12. create a new database table. create a new database. change existing database table The HAVING clause can be used only with ... 13. SELECT clause INSERT clause JOIN clause. DELETE clause. SQL is ... 14. ISO standard only both ANSI and ISO standard. ANSI standard only SQL is a language for 15. A. developing system programs B. relational database management system C. business applications only D. both A. and B. DDL stands for 16. A. Data Definition Language B. Data Division Language
  4. C. Data Dividing Language D. Digital Defining Language Which of the following is TRUE about Primary Key? 17. A. Same value of Primary Key can appear in more than one row in the table B. A Primary key defined column can be of type LONG C. A column that is defined as Primary Key cannot contain NULL value. D. Both A. and B. Which of the following commands denote DML commands 18. A. INSERT B. CREATE C. ALTER D. Both A. And B. Which of the command below undo the current transaction? 19. A. COMMIT B. ROLLBACK C. ALTER D. SAVEPOINT The SQL*PLUS Command used to delete a existing table is 20. A. DELETE TABLE B. DROP TABLE C. DEL TABLE D. REMOVE TABLE DML stands for 21. A. Data Manipulation Language B. Discrete Manipulation Language C. Data Modifying Language D. Digital Manipulation Language The order of sorting can be changed by SQL command 22. A. order from B. order to C. order in D. order by NULL Value is equal to 23. A. zero B. blank value C. "0" D. None of the Above If the base table of a view is deleted and we give SQL Select command on view table name 24. A. Gives the columns referred in select statement of view B. Reports a error
  5. C. Select only particular columns of view table D. Outputs the whole view table What does the following SQL command output 25. SELECT empname from emp where empname like 'S__'; A. This displays all empname whose empname is with four letter and starting with "S" B. This displays all empname whose empname starts with "S" C. This displays all empname whose empname is with four letter and ends with "S" D. This displays all empname In the SQL Command in matching a character pattern the symbol % denote 26. A. Any Single Character B. Any Sequence of zero or more characters C. NULL character D. Value equal to zero The SQL command used to avoid the selection of duplicate rows is 27. A. UNIQUE B. DISTINCT C. EXCLUSIVE D. DISCRETE Which of the following about DELETE FROM command in SQL is FALSE? 28. A. DELETE FROM command can be used in Deletion of single column value. B. DELETE FROM command is used to delete many rows from a table. C. DELETE FROM command is used to delete one or more rows from a table. D. All the Above Which of the following SQL command represent character data type? 29. A. CHAR B. VARCHAR C. VARCHAR2 D. All the Above To remove or take off all the granted privileges the SQL command used is 30. A. REMOVE PRIVILEGE ALL ON B. REVOKE ALL ON C. REMOVE ALL IN D. REVOKE ALL IN In order to fetch data from database which of the following SQL command is used? 31. A. RETRIEVE B. SELECT C. RECOVER D. FETCH Using SQL it is possible to create 32. A. Column Constraint B. Table Constraint
  6. C. Both A. and B. D. None of the Above What does the following SQL query return? 33. Alter table emp add ( Ename varchar (10) NOT NULL, Sal number (3) ); A. Gives the message Table altered B. Gives Error message as Error at line 1 C. Does not give any output D. None of the Above The SQL query gives output as: 34. select power(2,3) from dual; A. 8 B. 9 C. 6 D. 10 I the result of the combination of two tables to get duplicates also to be displayed we use command 35. A. UNION B. UNION ALL C. UNION SHOW ALL D. ALL UNION Which of the flowing denote group value functions in SQL 36. A. SUM B. AVG C. COUNT D. All the Above The SQL command for filling the table with data (that is rows) is 37. A. INSERT B. ADD C. FILL D. UPDATE The function that is used to cut off numbers to a specified number of decimal places is 38. A. CUTOFF B. ROUND C. TRUNC D. TRUNCATE Which of the following is TRUE? 39. A. The foreign key and the referenced key can be in the same table B. Combination of columns cannot be defined as foreign key
  7. C. A referential integrity is defined in child table. D. None of the Above Joining a Table to itself is called 40. A. Equi-Join B. Self Join C. Outer Join D. Inner Join Which of the following SQL statement retrieve all the columns from the table emp? 41. A. select all from emp; B. select entire from emp; C. select * from emp; D. select # fro emp; In a database row is also called as 42. A. Query B. Attribute C. Relation D. Record In SQL the operator that will be used to output a record if any of the condition listed holds true is 43. A. AND B. MINUS C. OR D. NOR The number of records in a table emp is given by the SQL statement 44. A. select total(*) from emp; B. select count(*) from emp; C. select sum(*) from emp; D. select total from emp; Which of the following will insert a record into emp table having empno and ea\name as columns? 45. A. INSERT INTO EMP VALUES ( 1000,'SRI'); B. INSERT INTO EMP (1000,'SRI'); C. INSERT FROM EMP VALUES (1000,'SRI'); D. INSERT FROM EMP (1000,'SRI'); which of the following denote single value function used in SQL 46. A. AVG ( ) B. SQRT ( ) C. COUNT ( ) D. All the Above Which of the following denote group clause in SQL 47. A. having B. group by
  8. C. Where D. Both A. and B. The SQL function SIGN (-50) gives value as 48. A. -50 B. 50 C. -1 D. 1 A table T1 having 100 rows is joined with a table T2 with 50 rows without specifying the joined column in 49. the where clause then result will have A. 100 rows B. 50 rows C. 150 rows D. 5000 rows SQL is a 50. A. Non- procedural language B. Procedural language C. Database Language D. Both A. and C. Which of the following is FALSE about a ALTER TABLE command of SQL? 51. A. ALTER TABLE command is used to create a table B. ALTER TABLE command is used to change the column elements in a table C. ALTER TABLE command is used to delete a table D. Both A. and C. The ORDER BY in SQL is used to order rows 52. A. in ascending order B. descending order C. both A. and B. D. None of the Above Consider an emp table having columns empno, empname, salary 53. Which of the following queries sort emp table by empname and then by salary in descending order A. select empno, empname, salary from emp order by empname, salary desc; B. select empno from emp sort by empname, sal in desc; C. select empno, empname, salary from emp sort in empname, salary desc; D. select # from emp sort by empname and salary in desc; Which of the following arithmetic functions are used in SQL 54. A. ROUND B. TRUNC C. ABS D. All the Above Views are created using SQL command 55. A. BUILD VIEW
  9. B. CONSTRUCT VIEW C. CREATE VIEW D. MAKE VIEW Consider the emp table having columns empno, ename 56. Which of eth following SQL query fetches empno that occur more than twice in the emp table A. select count(*) from emp group by empno having count(*) >2; B. select empno, count(*) from emp having count(*) >2; C. select empno, count(*) from emp where count(*) >2; D. select empno, count(*) from emp group by empno having count(*) >2; Data types gets converted automatically depending upon the usage. Which of the following is not possible in 57. automatic conversion of data? A. Number gets converted into character string B. DATE gets converted into character string C. Number gets converted into date D. None of the Above While creating tables the concept that is used to reduce redundancy in data is called 58. A. Views B. Aliases C. Sequence D. Normalization SQL support which of the following data model 59. A. Hierarchical Database Model B. Relational Database Model C. Network Database Model D. File Management Model Which of the following normalization forms are available? 60. A. Third Normal Form B. Boyce Code Normal Form C. Fourth normal Form D. Both A. and B. Which of the flowing denote pattern matching operator in SQL? 61. A. UNION B. MINUS C. LIKE D. SET Which of the following is TRUE about subqueries in SQL? 62. A. Sub queries must be enclosed in parenthesis B. BETWEEN cannot be used with a sub query C. Both A. and B. D. None of the Above
  10. Which of the following is TRUE about Views in SQL? 63. A. Views are windows of existing table B. Creation of view is done by using CREATE VIEW statement C. Views do not contain data but table from which it is created contain data D. All the Above A table created within a table is called 64. A. Sub query B. Normalization C. Nested Table D. Inner Table The SQL command used to comment multiple lines is 65. A. /* */ B. *** C. rem D. None of the Above The function used to calculate the arc sine of a value is 66. A. SIN( ) B. ASIN ( ) C. SINE( ) D. SINES( ) What does the following function value return? 67. ABS(-50) A. 50 B. -1 C. -50 D. 100
Đồng bộ tài khoản