1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu SQL quizzes docx

9 412 2
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề SQL Quizzes
Trường học Standard University
Chuyên ngành Database Management
Thể loại Tài liệu
Năm xuất bản 2023
Thành phố Hanoi
Định dạng
Số trang 9
Dung lượng 188 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

What does the following SQL statement do: SELECT Customer, COUNTOrder FROM Sales GROUP BY Customer HAVING COUNTOrder >5 Selects all customers from table Sales that have made more than 5

Trang 1

1. The NULL SQL keyword is used to

represent a missing or unknown value NULL in SQL represents nothing.

represent positive infinity

represent negative infinity

represent 0 value

2. The SQL DROP TABLE clause is used to

modify an existing table in a database

delete a table from the database

create a new table in the database

3. What does SQL stand for?

Structured Query Language.

Strict Query Language

Standard Query Language

Strong Query Language

4. Which 2 SQL keywords specify the sorting direction of the result set retrieved with ORDER BY clause

HIGH and LOW

ASC and DESC

UP and DOWN

5. Which of the following SQL clauses specifies a search condition?

WHERE

Trang 2

WHILE

SEARCH

6. What does the following SQL statement do: SELECT Customer, COUNT(Order) FROM Sales GROUP

BY 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

7. What is the INSERT command used for?

To insert data.

To retrieve data

To modify data

8. What does the UNION operator do?

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

9. Normalization is…

a special way of selecting data

the process of adding primary key to a table

Trang 3

the process of arranging information stored in a database in a way, which removes redundancy and ambiguity.

10. The TRUNCATE TABLE…

deletes all rows from a table

checks if the table has primary key specified

deletes the table

11. The JOIN is a SQL keyword used to

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

12. The CREATE TABLE statement is used to…

create a new database table.

create a new database

change existing database table

13. The HAVING clause can be used only with

SELECT clause

INSERT clause

JOIN clause

Trang 4

DELETE clause.

14. SQL is

ISO standard only

both ANSI and ISO standard.

ANSI standard only

15. SQL is a language for

A developing system programs

B relational database management system

C business applications only

D both A and B.

16. DDL stands for

A Data Definition Language

B Data Division Language

C Data Dividing Language

D Digital Defining Language

17. Which of the following is TRUE about Primary Key?

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

18. Which of the following commands denote DML commands

A INSERT

B CREATE

C ALTER

D Both A And B

19. Which of the command below undo the current transaction?

A COMMIT

B ROLLBACK

C ALTER

D SAVEPOINT

20. The SQL*PLUS Command used to delete a existing table is

A DELETE TABLE

B DROP TABLE

C DEL TABLE

D REMOVE TABLE

21. DML stands for

A Data Manipulation Language

B Discrete Manipulation Language

C Data Modifying Language

D Digital Manipulation Language

22. The order of sorting can be changed by SQL command

A order from

B order to

Trang 5

C order in

D order by

23. NULL Value is equal to

A zero

B blank value

C "0"

D None of the Above

24. If the base table of a view is deleted and we give SQL Select command on view table name

A Gives the columns referred in select statement of view

B Reports a error

C Select only particular columns of view table

D Outputs the whole view table

25. What does the following SQL command output

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

26. In the SQL Command in matching a character pattern the symbol % denote

A Any Single Character

B Any Sequence of zero or more characters

C NULL character

D Value equal to zero

27. The SQL command used to avoid the selection of duplicate rows is

A UNIQUE

B DISTINCT

C EXCLUSIVE

D DISCRETE

28. Which of the following about DELETE FROM command in SQL is FALSE?

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

29. Which of the following SQL command represent character data type?

A CHAR

B VARCHAR

C VARCHAR2

D All the Above

30. To remove or take off all the granted privileges the SQL command used is

A REMOVE PRIVILEGE ALL ON

B REVOKE ALL ON

C REMOVE ALL IN

D REVOKE ALL IN

31. In order to fetch data from database which of the following SQL command is used?

A RETRIEVE

B SELECT

C RECOVER

D FETCH

32. Using SQL it is possible to create

A Column Constraint

Trang 6

B Table Constraint

C Both A and B.

D None of the Above

33. What does the following SQL query return?

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

34. The SQL query gives output as:

select power(2,3) from dual;

A 8

B 9

C 6

D 10

35. I the result of the combination of two tables to get duplicates also to be displayed we use command

A UNION

B UNION ALL

C UNION SHOW ALL

D ALL UNION

36. Which of the flowing denote group value functions in SQL

A SUM

B AVG

C COUNT

D All the Above

37. The SQL command for filling the table with data (that is rows) is

A INSERT

B ADD

C FILL

D UPDATE

38. The function that is used to cut off numbers to a specified number of decimal places is

A CUTOFF

B ROUND

C TRUNC

D TRUNCATE

39. Which of the following is TRUE?

A The foreign key and the referenced key can be in the same table

B Combination of columns cannot be defined as foreign key

C A referential integrity is defined in child table

D None of the Above

40. Joining a Table to itself is called

A Equi-Join

B Self Join

C Outer Join

D Inner Join

Trang 7

41. Which of the following SQL statement retrieve all the columns from the table emp?

A select all from emp;

B select entire from emp;

C select * from emp;

D select # fro emp;

42. In a database row is also called as

A Query

B Attribute

C Relation

D Record

43. In SQL the operator that will be used to output a record if any of the condition listed holds true is

A AND

B MINUS

C OR

D NOR

44. The number of records in a table emp is given by the SQL statement

A select total(*) from emp;

B select count(*) from emp;

C select sum(*) from emp;

D select total from emp;

45. Which of the following will insert a record into emp table having empno and ea\name as columns?

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');

46. which of the following denote single value function used in SQL

A AVG ( )

B SQRT ( )

C COUNT ( )

D All the Above

47. Which of the following denote group clause in SQL

A having

B group by

C Where

D Both A and B

48. The SQL function SIGN (-50) gives value as

A -50

B 50

C -1

D 1

49. A table T1 having 100 rows is joined with a table T2 with 50 rows without specifying the joined column in the where clause then result will have

A 100 rows

B 50 rows

C 150 rows

D 5000 rows

50. SQL is a

A Non- procedural language

B Procedural language

Trang 8

C Database Language

D Both A and C.

51. Which of the following is FALSE about a ALTER TABLE command of SQL?

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

52. The ORDER BY in SQL is used to order rows

A in ascending order

B descending order

C both A and B

D None of the Above

53. Consider an emp table having columns empno, empname, salary

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;

54. Which of the following arithmetic functions are used in SQL

A ROUND

B TRUNC

C ABS

D All the Above

55. Views are created using SQL command

A BUILD VIEW

B CONSTRUCT VIEW

C CREATE VIEW

D MAKE VIEW

56. Consider the emp table having columns empno, ename

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;

57. Data types gets converted automatically depending upon the usage Which of the following is not possible

in 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

58. While creating tables the concept that is used to reduce redundancy in data is called

A Views

B Aliases

C Sequence

D Normalization

59. SQL support which of the following data model

A Hierarchical Database Model

B Relational Database Model

C Network Database Model

D File Management Model

Trang 9

60. Which of the following normalization forms are available?

A Third Normal Form

B Boyce Code Normal Form

C Fourth normal Form

D Both A and B.

61. Which of the flowing denote pattern matching operator in SQL?

A UNION

B MINUS

C LIKE

D SET

62. Which of the following is TRUE about subqueries in SQL?

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

63. Which of the following is TRUE about Views in SQL?

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

64. A table created within a table is called

A Sub query

B Normalization

C Nested Table

D Inner Table

65. The SQL command used to comment multiple lines is

A /* */

B ***

C rem

D None of the Above

66. The function used to calculate the arc sine of a value is

A SIN( )

B ASIN ( )

C SINE( )

D SINES( )

67. What does the following function value return?

ABS(-50)

A 50

B -1

C -50

D 100

Ngày đăng: 24/01/2014, 21:20

TỪ KHÓA LIÊN QUAN

w