wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

MySQL

Total questions: 94

Worksheet time: 47mins

Name
Class
Date
1.
  • Which of the following is described graphically using an E-R diagram?

Làm lại

a)

Data flows between processes

b)

Data source and destination

c)

Entities and relationships between entities

d)

Hierarchical data structure

2.
  • SQL query and modification commands make up a(n)

a)

XML

b)

DML

c)

HTML

d)

DDL

3.
  • A/an _________ is a piece of information that in some way describes an entity. It is a property of the entity and it quantifies, qualifies, classifies or specifies the entity.

a)

Table

b)

Process

c)

ERD

d)

Attribute

4.
  • What is the purpose of a Unique Constraint?

a)

To uniquely determine a table and columns within that table.

b)

To identify a specific row within a table, using one or more columns and/or foreign keys.

c)

Create an entity that is unlike any other entity aside from itself.

d)

To identify one unique instance of an entity, by using one or more attributes and/or relationships.

5.
  • Which of the following entities most likely contains invalid attributes?

a)

Entity: Home. Attributes: Number of Bedrooms, Owner, Address, Date Built

b)

Entity: Mother. Attributes: Name, Birthdate, Occupation, Salary

c)

Entity: Car. Attributes: Owner Occupation, Owner Salary, Speed

d)

Entity: Pet. Attributes: Name, Birthdate, Owner

6.
  • In a 1:N relationship, the foreign key is placed in:

a)

either table without specifying parent and child tables

b)

the parent table

c)

the child table

d)

either the parent table or the child table

7.
  • You are building a new database for a company with 10 departments. Each department contains multiple employees. In addition, each employee might work for several departments. How should you logically model the relationship between the department entity? 

a)

Create a mandatory one-to-many relationship between department and employee.

b)

Create an optional one-to-many relationship between department and employee.

c)

Create a new entry, create a one-to-many relationship from the employee to the new entry, and create a one-to-many relationship from the department entry to the new entry.

d)

Create a new entry, create a one-to-many relationship from the new entry to the employee entry, and then create a one-to-many relationship from the entry to the department entry.

8.
  • In a 1:1 relationship, the foreign key is placed in:

a)

either table without specifying parent and child tables

b)

the child table

c)

either the parent table or the child table

d)

the parent table

9.
  • In which of the following can many entity instances of one type be related to many entity instances of another type?

a)

One-to-One Relationship

b)

Many-to-Many Relationship

c)

One-to-Many Relationship

d)

Composite Relationship

10.
  • What data type is “Distance from home to school ”should be?

a)

Decimal

b)

Text

c)

Bigint

d)

Int

11.
  • Which of the following is not an operator in categories of SQL Comparison Operators?

a)

Not less than (!<)

b)

Addition (+)

c)

Less than or equal to (<=)

d)

Not greater than (!>)

12.
  • What is the storage size of smallmoney data type?

a)

3 bytes

b)

2 bytes

c)

8 bytes

d)

4 bytes

13.
  • Từ NULLkhóa SQL được sử dụng để…

a)

represent positive infinity.

b)

represent negative infinity.

c)

represent 0 value.

d)

represent a missing or unknown value.

14.
  • Which of the following SQL statements is used to delete both the structure and data of the named table STUDENT?

a)

DROP TABLE STUDENT

b)

REMOVE TABLE STUDENT

c)

DELETE TABLE STUDENT

d)

DELETE FROM STUDENT

15.
  • Which one of the following deletes all the entries but keeps the structure of the relation.

a)

Delete from instructor where dept name= ’Finance’;

b)

Delete from instructor where salary between 13000 and 15000;

c)

Delete from r where P;

d)

Delete from instructor;

16.
  • The SQL ALTER statement can be used to:

a)

change the table structure

b)

change the table data

c)

add rows to the table

d)

delete rows from the table

17.
  • SQL data definition commands make up a(n) ________________

a)

DDL

b)

DML

c)

HTML

d)

XML

18.
  • Identify the correct syntax for IDENTITY property?

a)

Column-name Data type IDENTITY(SEED, INCREMENT)

b)

Column-name Data type IDENTITY (???)

c)

Column-name IDENTITY(SEED, INCREMENT)

d)

Column-name Data type IDENTITY(INCREMENT)

19.
  • A primary key constraint cannot be deleted if it is being referenced by a foreign key constraint in another table; the foreign key constraint must be deleted first?

a)

True

b)

False

20.
  • A foreign key is:

a)

a column containing the primary key of another table

b)

all of the above are above correct

c)

used to define data types

d)

used to define null status

21.
  • The difference between the DELETE and TRUNCATE SQL clauses is:

a)

The DELETE clause deletes all rows in a database table, while the TRUNCATE clause can have a WHERE condition and might or might not delete all rows in a table.

b)

The TRUNCATE clause is identical to the DELETE clause

c)

The TRUNCATE clause deletes all rows in a database table, while the DELETE clause can have a WHERE condition and might or might not delete all rows in a table.

d)

The TRUNCATE clause deletes table structure and it's all data, while the DELETE clause can have a WHERE condition and might or might not delete all rows in a table.

22.
  • LOCATIONS(subject_code, department_name, location_id, city);


  • Which code snippet will alter the table LOCATIONS and change the datatype of the column CITY to varchar(30)?

a)

ALTER TABLE locations MODIFY COLUMN (city varchar(30));

b)

MODIFY TABLE locations ADD (city varchar(30));

c)

ALTER TABLE locations ALTER COLUMN city varchar(30);

d)

None of the above

23.
  • Which of the following is not true about complex views?

a)

They derive data from more than one table.

b)

They contain no functions or grouping.

c)

You cannot perform DML operations through a complex view.

d)

All of the above are true.

24.
  • Which of the following code will delete a view named all_marks_english?

a)

delete view all_marks_english;

b)

drop view all_marks_english;

c)

delete all_marks_english

d)

drop all_marks_english;

25.
  • What is an index?

a)

An index is the same as alias.

b)

An index is a database table attribute, which speeds-up data search within a table.

c)

An index is a special way to join 2 or more tables.

d)

All of the above

26.
  • Which is the purpose of index in SQL?

a)

It leads to enchance the query performance.

b)

It lead to provide an index to a record.

c)

It lead to perform fast searches.

d)

All of the above

27.
  • Which one of the following is not true for a view?

a)

They derive data from more than one table.

b)

They contain no functions or grouping.

c)

You cannot perform DML operations through a complex view.

d)

All of the above are true.

28.
  • In the UPDATE statement, if we do not use the WHERE clause, then:

a)

Will not execute the update statement

b)

All of the records will be updated

c)

No records are updated

d)

Only some records are updated

29.
  • The SQL WHERE clause:

a)

limits the column data that are returned.

b)

limits the row data are returned.

c)

Both A and B are correct.

d)

Neither A nor B are correct.

30.
  • The SQL keyword(s) ________ is used with wildcards.

a)

IN and NOT IN

b)

LIKE only

c)

IN only

d)

NOT IN only

31.
  • Which of the following is true about the COUNT function?

a)

COUNT(*) returns the number of rows in the table.

b)

COUNT(exp) returns the number of rows with non-null values for the exp.

c)

COUNT(DISTINCT exp) returns the number of unique, non-null values in the column.

d)

All are true.

32.
  • Which SQL keyword is used to remove duplicate rows in the result of an SQL query SELECT?

a)

ORDER BY

b)

SORT

c)

UNIQUE

d)

DISTINCT

33.
  • Which of the following query is correct to select the highest salary of the employees in each Department?


a)

SELECT e.dept_id, e.salary FROM Employee e GROUP BY e.dept_id ORDER BY MAX(e.salary); 

b)

SELECT e.dept_id, e.salary FROM Employee e GROUP BY e.dept_id ORDER BY MAX(e.salary); 

c)

SELECT e.dept_id, e.salary FROM Employee e GROUP BY e.dept_id ORDER BY MAX(e.salary); 

d)

SELECT e.dept_id, MAX(e.salary) FROM Employee e;

34.
  • What is the difference between the WHERE and HAVING SQL clauses?

a)

The WHERE SQL clause condition(s) is applied to all rows in the result set before the HAVING clause is applied (if present). The HAVING clause is used only with SELECT SQL statements and specifies a search condition for an aggregate or a group.

b)

The WHERE and the HAVING clauses are identical

c)

The HAVING SQL clause condition(s) is applied to all rows in the result set before the WHERE clause is applied (if present). The WHERE clause is used only with SELECT SQL statements and specifies a search condition for an aggregate or a group.

d)

All of the above answers are not correct

35.
  • What does the UNION operator do?

a)

The UNION operator sorts the selected result set.

b)

The UNION operator behaves the same as the JOIN SQL clause.

c)

The UNION operator combines the results of two or more queries into one result that includes all the rows from the queries in the union.

d)

All of the above

36.
  • Which of the following query would show the total number of lines in the 'emp' table?

a)

SELECT count_rows FROM emp;

b)

SELECT totalrows FROM emp;

c)

SELECT rowcount FROM emp;

d)

SELECT count(*) FROM emp;

37.
  • What is purpose of CAST function in SQL Server?

a)

It converts or cast an expression of 1 data type to another

b)

Add description to statement

c)

It can not be in SQL Server

d)

None of the above

38.
  • Trong SQL, ABShàm được dùng để làm gì?

a)

To return the absolute, positive value of a numeric expression.

b)

To return the maximum value of a numeric expression.

c)

To return the minimum value of a numeric expression.

39.
  • The AVG SQL function returns the …

a)

the sum of values in a column.

b)

maximum value from a column.

c)

average in the values in agroup.

d)

minimum value from a column.

40.
  • A data manipulation command the combines the records from one or more tables is called 

a)

PROJECT

b)

JOIN

c)

SELECT

d)

PRODUCT

41.
  • Which one is NOT type of Outer Join ?

a)

LEFT (OUTER) JOIN

b)

RIGHT (OUTER) JOIN

c)

FULL (OUTER) JOIN

d)

BOTH JOIN

42.

We refer to a join as a self-join when?

a)

we are using left and right join together

b)

we are joining more than 2 tables

c)

we are joining table to itself

d)

We are joining two tables only

43.
  • How many tables can be included with a join?

a)

A. One

b)

B. Two

c)

C. Three

d)

D. All of the mentioned options

44.
  • Subqueries can be nested multiple times:

a)

True

b)

False

45.
  • Which of the following statements is true concerning subqueries?

a)

Involves the use of an inner and outer query

b)

Cannot return the same result as a query that is not a subquery

c)

Does not start with the word SELECT

d)

All of the mentioned options

46.
  • Which of the following is a correlated subquery?

a)

Uses the result of an inner query to determine the processing of an outer query

b)

Uses the result of an outer query to determine the processing of an inner query

c)

Uses the result of an inner query to determine the processing of an inner query

d)

Uses the result of an outer query to determine the processing of an outer query

47.
  • Sub-queries can be nested in?

a)

UPDATE statements only.

b)

INSERT statements only.

c)

DELETE statements only.

d)

UPDATE, DELETE, INSERT and SELECT statements.

48.
  • What does CTE stand for?

a)

Control Table Expressions

b)

Common Table Expression

c)

Common Table Exception

d)

Comon Triger Expression

49.
  • Point out the WRONG statement.

a)

The ROW_NUMBER function simply assigns sequential numbering to the records of a result-set or to the records groups of a result-set.

b)

OVER clause is not required in all ranking functions.

c)

SQL Server introduced four different ranking functions

d)

All of the mentioned.

50.
  • Which of the clause is not mandatory?

a)

OVER clause.

b)

ORDER BY clause.

c)

PARTITION BY clause.

d)

All of the mentioned.

51.
  • Point out the WRONG statement.

a)

RANK() returns the rank of each row in the result set of partitioned column.

b)

DENSE_RANK() is same as RANK() function. Only difference is returns rank without gaps.

c)

NTILE() distributes the columns in an ordered partition into a specified number of groups.

d)

ROW_NUMBER() returns the serial number of the row order by specified column.

52.
  • Which of the following function is used when you want all tied rows to have the same ranking?

a)

RANK.

b)

NTILE.

c)

ROW_NUMBER.

d)

None of the mentioned.

53.
  • Which of the following SQL statements is used create database FASM in SQL Server?

a)

DROP DATABASE FASM;

b)

CREATE DB FASM;

c)

CREATE DATABASE FASM;

d)

CREATE NEW DATABASE FASM;

54.
  • What is the purpose of the SQL AS clause?

a)

The AS clause defines a search condition.

b)

The AS clause is used with the JOIN clause only.

c)

The AS SQL clause is used change the name of a column in the result set or to assign a name to a derived column.

d)

All of the above answers are not correct

55.
  • What is MS SQLServer?

a)

Microsoft SQL Server is a database platform for online Transaction Processing (OLTP).

b)

Microsoft SQL Server is a database platform for online Transaction Processing (OLTP), data warehousing, e-commerce application. It is also a business intelligence platform for data intergration, analysis, and reporting solutions.

c)

Microsoft SQL Server is also a business intelligence platform for data intergration, analysis, and reporting solutions.

d)

Microsoft SQL Server is a database platform for data warehousing, e-commerce applications.

56.
  • What is components of MS SQL server?

a)

Database Engine, Intergration Services, Reporting Services, Analysis Services.

b)

Service Broker, Intergration Services, Replication Services, Analysis Services.

c)

Service Broker, Intergration Services, Replication, Reporting Services, Full-Text Search.

d)

Replication, Full-Text Search, Database Engine, Reporting Services, Analysis Services.

57.
  • What is database engine?

a)

Database Engine is supporting rapid analysis of business data

b)

Database Engine is an application programing interface (API)

c)

Database Engine is a complete set of tools that you can use to create and manage reports.

d)

Database Engine is the core service for storing, processing, and securing data.

58.
  • What is integration services (SSIS)?

a)

Integartion Services (SISS) is support for messaging and queuing applications.

b)

Integration Services (SISS) is a platform for building high performance data intergration solutions, including extraction, transformation, and load packages for data warehousing.

c)

Integration Services (SISS) is developing applications that generate and send notifications.

d)

Intergration Services (SISS) is synchronizing between databases to maintain consistency.

59.

When execute the code, which message is printed:

a)

Error:

b)

Error: this field is not define

c)

Error reporting system overflows in the @message variable

d)

All answers are not correct

60.

In any case, the following case is TRUE:

a)

The output of the @sum variable is: 55

b)

The loop never stops

c)

The output of the @sum variable is: 0

d)

The output of the @sum variable is: 1

61.
  • Which code snippet will alter the table LOCATIONS and change the datatype of the column CITY to varchar(30)?

Làm lại

a)

ALTER TABLE locations MODIFY COLUMN (city varchar(30));

b)

MODIFY TABLE locations ADD (city varchar(30));

c)

ALTER TABLE locations ALTER COLUMN city varchar(30);

d)

None of the above

62.
  • Now, tell the problem in query?

a)

Above query is correct

b)

Replace nothing with view name.

c)

View name must be after keyword view and 'nothing' is not keyword, so should be replace with *.

d)

Replace nothing with column names.

63.

Which of the following is true?

a)

10% price increase (UnitPrice) in the Products table, for products with a price of 60 or 70

b)

10% price increase (UnitPrice) in the Products table, for products priced between 60 and 70

c)

10% price increase (UnitPrice) in the Products table, for products priced between 60 and 70, excluding 2 values of 60 and 70

d)

All answers are wrong.

64.
a)

1009, 1001, 1018

b)

1009, 1018

c)

1018

d)

1001

65.
  • Which SQL statement allows you to insert the following price of data into BOOK_INFORMATION?

Làm lại

a)

ADD INTO BOOK_INFORMATION WITH (20, 'FRESHER ACADEMY SQL TUTORIAL ', 15);

b)

INSERT INTO BOOK_INFORMATION USING (20, 'FRESHER ACADEMY SQL TUTORIAL', 15);

c)

INSERT INTO BOOK_INFORMATION VALUES (20, 'FRESHER ACADEMY SQL TUTORIAL', 15);

d)

ADD INTO BOOK_INFORMATION VALUES (20, 'FRESHER ACADEMY SQL TUTORIAL', 15);

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


a)

UPDATE BOOK_INFORMATION SET price = 20 WHERE book_title = 'ELEMENTARY SCHOOL GUIDE'; 

b)

B. UPDATE TABLE BOOK_INFORMATION SET price = 20 WHERE book_title = 'ELEMENTARY SCHOOL GUIDE';

c)

UPDATE TABLE BOOK_INFORMATION SET price = 20 WHERE book_id = 'ELEMENTARY SCHOOL GUIDE';

d)

UPDATE BOOK_INFORMATION CHANGE price = 20 WHERE book_title = 'ELEMENTARY SCHOOL GUIDE';

67.
  • Which of the following query statements is syntax error?

a)

b)

c)

d)

68.

Result of the above two queries is:

a)

8,8

b)

6,6

c)

7,7

d)

None of the above

69.
  • Which one is correct syntax for applying UNION operator:

a)

b)

c)

d)

70.
  • By default, the order by clause lists items in ______ order.

a)

Descending

b)

Any

c)

Same

d)

Ascending

71.

Which of the following SQL statements would find all books whose title starts with 'A'?

a)

b)

c)

d)

72.
  • Which of the following SQL statements would list all stores that total sales amount is over 5000? 


a)

b)

c)

d)

73.
  • Which of the following query would display the lowest of cost in the Product table?


a)

Select cost from Product where cost = min;

b)

Select min(cost) from Product;

c)

Select min(cost) from Product where cost = min(cost);

d)

Select cost from Product where cost = min(cost);

74.
  • Which of the following is true?

a)

Count all of the bills

b)

Count number of bills by the customer

c)

List out number of bills by the date

d)

The statement is syntax error

75.
  • It will return:

a)

Date & Time: Apr 4 2014 9:25AM

b)

Date & Time: Mar 5 2014 9:25AM

c)

Date & Time: Mar 4 2014 9:25AM

d)

Date & Time: Apr 5 2014 9:25AM

76.
  • To select students in the TH department with the highest average of score, which statement should you use?

a)

b)

c)

77.

Which code snippet will list the id and names of class with more than 15 students?

a)

b)

c)

d)

78.
  • Which code snippet will display records with the following three columns: classId, className and amount (amount of students)?


a)

b)

c)

d)

79.
a)

b)

c)

d)

80.
a)

b)

c)

d)

81.
a)

S101, S101, S102, S103, S104, S104

b)

S101, S101, S103, S104, S104

c)

S101, S102, S103, S104

d)

S101, S103, S104

82.
a)

INNER JOIN

b)

CROSS JOIN

c)

SELF JOIN

d)

OUTER JOIN

83.
a)

b)

c)

d)

84.
a)

b)

c)

d)

85.
a)

b)

c)

86.
a)

b)

c)

d)

87.
a)

b)

c)

d)

All of the above

88.
a)

b)

c)

d)

89.
a)

No rows

b)

The 900 rows in the Customer table with matching rows in the SalesOrder table

c)

The 1000 rows in the Customer table

d)

None of the above

90.
a)

Fukuda, Oohira

b)

Saito, Fukuda, Oohira

c)

Tanaka, Suzuki

d)

Tanaka, Suzuki, Saito

91.
  • You need to implement a common table expression (CTE).
    Which code segment should you use?

a)

b)

c)

d)

None of the above

92.
a)

b)

c)

d)

93.
a)

b)

c)

d)

94.
a)

101 rows will be returned without error.

b)

10,001 rows will be returned without error.

c)

101 rows will be returned with a maximum recursion error.

d)

10,001 rows will be returned with a maximum recursion error.