Anda di halaman 1dari 54

Question 1 of 20

5.0/ 5.0 Points

Which of the following operation is used if we are interested in only certain columns of a table?
A. UNION
B. SELECTION
C. JOIN
D. PROJECTION

Question 2 of 20

5.0/ 5.0 Points

Which of the following SQL statements can extract employee names whose salary is $10000 or
higher from the table human_resource?
A. SELECT employee_name, salary FROM human_resource
GROUP BY salary HAVING COUNT(*)>=10000
B. SELECT salary FROM human_resource WHERE employee_name >=10000 GROUP
BY salary
C. SELECT employee_name FROM human_resource WHERE salary>=10000
D. SELECT employee_name, COUNT(*) FROM human_resource
WHERE salary>=10000 GROUP BY employee_name
Question 3 of 20

5.0/ 5.0 Points

A primary key is combined with a foreign key creates:


A. Network model between the tables that connect them.
B. Many to many relationship between the tables that connect them.
C. of the above.
D. Parent-Child relationship between the tables that connect them.

Question 4 of 20

5.0/ 5.0 Points

SQL can be used to:


A. create database structures only.
B. query database data only.
C. modify database data only.
D. All of the above can be done by SQL.

Question 5 of 20

5.0/ 5.0 Points

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


A. View is derived from other tables.
B. View is a virtual table.
C. A view definition is permanently stored as part of the database
D. View never contains derived columns.

Question 6 of 20

5.0/ 5.0 Points

Which of the following SQL statements defines a schema?


A. CREATE
B. DELETE
C. SELECT
D. INSERT

Question 7 of 20

Which of the following aggregate functions does not ignore nulls in its results?.
A. COUNT (*)
B. MAX

5.0/ 5.0 Points

C. COUNT.
D. MIN

Question 8 of 20

5.0/ 5.0 Points

The ______ operator is used to compare a value to a list of literals values that have been
specified.
A. IN
B. BETWEEN
C. ANY
D. ALL

Question 9 of 20

5.0/ 5.0 Points

Which of the following SQL statements corresponds to the projection operation of the
relational algebra that can extract only the column Continent from the table Country and
eliminate duplicates from the records returned?

A. SELECT *FROM Country


B. SELECT DISTINCT Continent FROM Country
C. SELECT *FROM Country GROUP BY Continent
D. SELECT Continent FROM Country

Question 10 of 20

5.0/ 5.0 Points

Your database contains a table named Purchases. The table includes a DATETIME column
named PurchaseTime that stores the date and time each purchase is made. There is a nonclustered index on the PurchaseTime column. The business team wants a report that displays the
total number of purchases made on the current day. You need to write a query that will return the
correct results in the most efficient manner. Which Transact-SQL query should you use?
A. SELECT COUNT(*)

FROM Purchases
WHERE PurchaseTime >= CONVERT(DATE, GETDATE())
AND PurchaseTime < DATEADD(DAY, 1, CONVERT(DATE, GETDATE()))
B. SELECT COUNT(*)
FROM Purchases
WHERE CONVERT(VARCHAR, PurchaseTime, 112) = CONVERT(VARCHAR,
GETDATE(), 112)
C. SELECT COUNT(*)
FROM Purchases
WHERE PurchaseTime = CONVERT(DATE, GETDATE())
D. SELECT COUNT(*)
FROM Purchases
WHERE PurchaseTime = GETDATE()
Question 11 of 20

5.0/ 5.0 Points

AS clause is used in SQL for:


A. Rename operation.
B. Projection operation.
C. Selection operation.
D. Join operation.

Question 12 of 20

5.0/ 5.0 Points

Which of the following is the appropriate SQL statement that is used to create Table A from
Persons Table?

A. SELECT name FROM Persons WHERE country LIKE '%Korea%' AND gender = 'F'
AND age = 26
B. SELECT name FROM Persons WHERE country LIKE '%Korea%' AND gender = 'F'

OR age = 26
C. SELECT name FROM Persons WHERE country LIKE '%Korea%' OR gender = ' F'
AND age = 26
D. SELECT name FROM Persons WHERE country LIKE '%Korea%' OR gender = 'F' OR
age = 26
Question 13 of 20

5.0/ 5.0 Points

There is a table including the data items shown below. Which of the following SQL statements
should be used to insert a new row in the student table?
\

A. INSERT INTO student VALUES (101, 100 Happy Lane, 2001-06-14, Dave);
B. INSERT INTO student (stud_id, name, graduation) VALUES (101, Dave, 2001-0614);
C. INSERT INTO student VALUES (101, Dave, 100 Happy Lane, 2001-06-14);
D. INSERT INTO student (stud_id, address, name, graduation)
VALUES (101, 100 Happy Lane, Dave, 2001-06-14);
Question 14 of 20

5.0/ 5.0 Points

Count function in SQL returns the number of :


A. Groups
B. Values
C. Distinct values
D. Columns

Question 15 of 20

5.0/ 5.0 Points

Which of the following product groups can be found when searching the Product Inventory
table for products with a sales price of 500 dollars or more per unit and an inventory of less than
10 units?

A. Large refrigerator, medium refrigerator, small refrigerator, portable refrigerator, air


purifier, coffee maker, and air conditioner
B. Medium refrigerator, small refrigerator, portable refrigerator, coffee maker, and air
conditioner
C. Large refrigerator, medium refrigerator, small refrigerator, air purif ier, and air
conditioner
D. Medium refrigerator, small refrigerator, and air conditioner

Question 16 of 20

0.0/ 5.0 Points

Which of the following SQL statements for the stated table Shipment_Record produces the
largest value as a result of its execution?

A. SELECT SUM(quantity) FROM shipment_record WHERE date=19991011


B. SELECT COUNT(*) FROM shipment_record
C. SELECT MAX(quantity) FROM shipment_record
D. SELECT AVG(quantity) FROM shipment_record

Question 17 of 20

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


A. XML
B. DML
C. DDL
D. HTML

5.0/ 5.0 Points

Question 18 of 20

5.0/ 5.0 Points

You are a database developer of a Microsoft SQL Server database. The database contains a table
named Customers that has the following definition:

You need to ensure that the CustomerId column in the Orders table contains only values that exist in the
CustomerId column of the Customer table. Which Transact-SQL statement should you use?

A. ALTER TABLE Orders


ADD CONSTRAINT FX_Orders_CustomerID FOREIGN KEY (CustomerId) REFERENCES
Customer (CustomerId)
B. ALTER TABLE Customer
ADD CONSTRAINT FK_Customer_CustomerID FOREIGN KEY {CustomerID)
REFERENCES Orders (CustomerId)
C. ALTER TABLE Customer
ADD CONSTRAINT FK_Customer_OrderID FOREIGN KEY (CrderlD) REFERENCES
Orders (CrderlD);
ALTER TABLE Orders
ADD CONSTRAINT PK Orders CustomerId PRIMARY KEY (CustomerID)
D. ALTER TABLE Customer
ADD OrderId INT NOT NULL;
E. ALTER TABLE Orders
ADD CONSTRAINT CK_Crders_CustomerID
CHECK (CustomerId IN (SELECT CustomerId FROM Customer))
Question 19 of 20

5.0/ 5.0 Points

You want to create a table to store Microsoft Word documents. You need to ensure that the
documents must only be accessible via Transact-SQL queries. Which Transact-SQL statement
should you use?
A. ) CREATE TABLE DocumentStore AS FileTable

B. CREATE TABLE DocumentStore


(
[Id] [uniqueidentifier] ROWGUIDCOL NOT NULL UNIQUE,
[Document] VARBINARY(MAX) FILESTREAM NULL
)
GO
C. CREATE TABLE DocumentStore
(
[Id] hierarchyid,
[Document] NVARCHAR NOT NULL
)
GO
D. CREATE TABLE DocumentStore
(
[Id] INT NOT NULL PRIMARY KEY,
[Document] VARBINARY(MAX) NULL
)
GO
5.0/ 5.0 Points

Question 20 of 20

Which of the following is a legal expression in SQL?


A. SELECT NULL FROM EMPLOYEE;
B. SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL;
C. None of the above
D. SELECT NAME FROM EMPLOYEE;

Part 1 of 1 -

75.0/ 100.0 Points

5.0/ 5.0 Points


Question 1 of 20

DML is provided for:

A. Manipulation & processing of database.

B. Description of logical structure of database.

C. Definition of physical structure of database system.

D. Addition of new structures in the database system.

Question 2 of 20

5.0/ 5.0 Points

Which is the SQL constraint that allows inputting NULL in a specified column in a
DBMS table but that does not allow inputting the already entered value?

A. PRIMARY KEY

B. CHECK

C. UNIQUE

D. REFERENCES

Question 3 of 20

5.0/ 5.0 Points

Count function in SQL returns the number of :

A. Values

B. Groups

C. Distinct values

D. Columns

Question 4 of 20

5.0/ 5.0 Points

Given below data in the Leased_Apartment_Table table

If the following statement is executed, which data group is extracted?


SELECT Property FROM Leased_Apartment_Table
WHERE (District=Tu Liem OR Time_From_The_Station<15) AND
(Floor_Space>60)

A. A, C, D, E

B. A

C. A, C

D. B, D, E

Question 5 of 20

5.0/ 5.0 Points

Which of the following is the appropriate SQL statement that is used to create Table
A from Persons Table?

A. SELECT name FROM Persons WHERE country LIKE '%Korea%' AND gender =
'F' AND age = 26
B. SELECT name FROM Persons WHERE country LIKE '%Korea%' OR gender = '
F' AND age = 26
C. SELECT name FROM Persons WHERE country LIKE '%Korea%' AND gender =
'F' OR age = 26
D. SELECT name FROM Persons WHERE country LIKE '%Korea%' OR gender =
'F' OR age = 26
Question 6 of 20

0.0/ 5.0 Points

Which of the following SQL statements for the stated table Shipment_Record
produces the largest value as a result of its execution?

A. SELECT MAX(quantity) FROM shipment_record

B. SELECT COUNT(*) FROM shipment_record

C. SELECT SUM(quantity) FROM shipment_record WHERE date=19991011

D. SELECT AVG(quantity) FROM shipment_record

Question 7 of 20

5.0/ 5.0 Points

Which of the following is a legal expression in SQL?

A. SELECT NAME FROM EMPLOYEE;

B. None of the above

C. SELECT NULL FROM EMPLOYEE;

D. SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL;

Question 8 of 20

Which of the following is not the SQL statement?

A. INSERT

5.0/ 5.0 Points

B. DELETE

C. DIVIDE

D. CREATE

Question 9 of 20

5.0/ 5.0 Points

Which of the following is a comparison operator in SQL?

A. =

B. LIKE

C. BETWEEN

D. All of the above

Question 10 of 20

SQL is:

A. a data sublanguage.

B. a programming language

0.0/ 5.0 Points

C. an operating system

D. a DBMS.

Question 11 of 20

5.0/ 5.0 Points

Which of the following SQL statements can extract employee names whose salary
is $10000 or higher from the table human_resource?

A. SELECT salary FROM human_resource WHERE employee_name >=10000


GROUP BY salary
B. SELECT employee_name, COUNT(*) FROM human_resource
WHERE salary>=10000 GROUP BY employee_name
C. SELECT employee_name, salary FROM human_resource
GROUP BY salary HAVING COUNT(*)>=10000
D. SELECT employee_name FROM human_resource WHERE salary>=10000

Question 12 of 20

SQL query and modification commands make up a(n) ________________

A. XML

5.0/ 5.0 Points

B. DDL

C. HTML

D. DML

Question 13 of 20

0.0/ 5.0 Points

There is a student score table shown below with basic and advanced subject codes
which begin with letters B and A respectively. Which of the following SQL
statements can be used to retrieve students, from the score table, whose basic
subject score is 70 or more and examination date is 2007-05-04?

A. SELECT student_number FROM score_table WHERE score >=70 AND


examination_date = 2007-05-04 AND subject_code LIKE B%
B. SELECT * FROM score_table WHERE score >=70 AND examination_date =
2007-05-04
C. SELECT student_number FROM score_table WHERE score >=70 AND
examination_date = 2007-05-04
D. SELECT * FROM score_table WHERE score >=70 AND examination_date =
2007-05-04 AND subject_code LIKE B_ _
Question 14 of 20

5.0/ 5.0 Points

A primary key is combined with a foreign key creates:

A. of the above.

B. Parent-Child relationship between the tables that connect them.

C. Many to many relationship between the tables that connect them.

D. Network model between the tables that connect them.

Question 15 of 20

5.0/ 5.0 Points

Which of the following operation is used if we are interested in only certain columns
of a table?

A. PROJECTION

B. JOIN

C. SELECTION

D. UNION

Question 16 of 20

Which of the following two descriptions on the operation of the stated


customer_table is wrong?

0.0/ 5.0 Points

Operation 1: SELECT CUSTOMER_NAME, ADDRESS FROM CUSTOMER


Operation 2: SELECT * FROM CUSTOMER WHERE CUSTOMER_NO = D0010

A. The table extracted by operation 2 has two columns

B. The table extracted by operation 1 has two columns

C. The table extracted by operation 1 has four rows

D. Operation 1 is PROJECTION and operation 2 is SELECTION

Question 17 of 20

5.0/ 5.0 Points

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

A. XML

B. DDL

C. DML

D. HTML

0.0/ 5.0 Points


Question 18 of 20

You develop a database for a travel application. You need to design tables and other
database objects. You create a view that displays the dates and times of the airline
schedules on a report. You need to display dates and times in several international
formats. What should you do?

A. Use the FORMAT function.

B. Use the CAST function.

C. Use the DATETIME2 data type.

D. Use the DATE data type.

E. Use the DATETIME data type.

Question 19 of 20

5.0/ 5.0 Points

There is a table including the data items shown below. Which of the following SQL
statements should be used to insert a new row in the student table?
\

A. INSERT INTO student (stud_id, address, name, graduation)


VALUES (101, 100 Happy Lane, Dave, 2001-06-14);

B. INSERT INTO student VALUES (101, Dave, 100 Happy Lane, 2001-06-14);

C. INSERT INTO student VALUES (101, 100 Happy Lane, 2001-06-14, Dave);

D. INSERT INTO student (stud_id, name, graduation) VALUES (101, Dave,


2001-06-14);
Question 20 of 20

5.0/ 5.0 Points

You are a database developer of a Microsoft SQL Server 2012 database. You are
designing a table that will store Customer data from different sources. The table will
include a column that contains the CustomerID from the source system and a
column that contains the SourceID. A sample of this data is as shown in the
following table.

You need to ensure that the table has no duplicate CustomerID within a SourceID. You also need to
ensure that the data in the table is in the order of SourceID and then CustomerID. Which Transact- SQL
statement should you use?

A. CREATE TABLE Customer


(
SourceID int NOT NULL IDENTITY,
CustomerID int NOT NULL IDENTITY,
CustomerName varchar(255) NOT NULL
);
B. CREATE TABLE Customer
(
SourceID int NOT NULL,
CustomerID int NOT NULL PRIMARY KEY CLUSTERED,

CustomerName varchar(255) NOT NULL


);
C. CREATE TABLE Customer
(
SourceID int NOT NULL,
CustomerID int NOT NULL,
CustomerName varchar(255) NOT NULL,
CONSTRAINT PK_Customer PRIMARY KEY CLUSTERED
(SourceID, CustomerID)
);
D. CREATE TABLE Customer
(
SourceID int NOT NULL PRIMARY KEY CLUSTERED,
CustomerID int NOT NULL UNIQUE,
CustomerName varchar(255) NOT NULL
);

Question 1 of 20
SQL data definition commands make up a(n) ________________ .

A. XML

B. DDL

C. DML

D. HTML

5.0/ 5.0 Points

Question 2 of 20

5.0/ 5.0 Points

Which of the following aggregate functions does not ignore nulls in its results?.

A. MAX

B. MIN

C. COUNT.

D. COUNT (*)

Question 3 of 20

5.0/ 5.0 Points

A primary key is combined with a foreign key creates:

A. of the above.

B. Parent-Child relationship between the tables that connect them.

C. Many to many relationship between the tables that connect them.

D. Network model between the tables that connect them.

Question 4 of 20
DML is provided for:

5.0/ 5.0 Points

A. Manipulation & processing of database.

B. Description of logical structure of database.

C. Definition of physical structure of database system.

D. Addition of new structures in the database system.

Question 5 of 20

5.0/ 5.0 Points

Which of the following is a comparison operator in SQL?

A. =

B. LIKE

C. BETWEEN

D. All of the above

Question 6 of 20
Which of the following is not the SQL statement?

A. INSERT

5.0/ 5.0 Points

B. DELETE

C. DIVIDE

D. CREATE

Question 7 of 20

5.0/ 5.0 Points

There is a table including the data items shown below. Which of the following SQL statements should be
used to insert a new row in the student table?
\

A. INSERT INTO student (stud_id, address, name, graduation)


VALUES (101, 100 Happy Lane, Dave, 2001-06-14);
B. INSERT INTO student VALUES (101, Dave, 100 Happy Lane, 2001-0614);
C. INSERT INTO student VALUES (101, 100 Happy Lane, 2001-06-14,
Dave);
D. INSERT INTO student (stud_id, name, graduation) VALUES (101, Dave,
2001-06-14);
Question 8 of 20

5.0/ 5.0 Points

The ______ operator is used to compare a value to a list of literals values that have been specified.

A. BETWEEN

B. ALL

C. ANY

D. IN

Question 9 of 20

0.0/ 5.0 Points

Which of the following two descriptions on the operation of the stated customer_table is wrong?

Operation 1: SELECT CUSTOMER_NAME, ADDRESS FROM CUSTOMER


Operation 2: SELECT * FROM CUSTOMER WHERE CUSTOMER_NO = D0010

A. The table extracted by operation 2 has two columns

B. The table extracted by operation 1 has two columns

C. The table extracted by operation 1 has four rows

D. Operation 1 is PROJECTION and operation 2 is SELECTION

5.0/ 5.0 Points


Question 10 of 20

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

A. View never contains derived columns.

B. View is a virtual table.

C. View is derived from other tables.

D. A view definition is permanently stored as part of the database

Question 11 of 20

5.0/ 5.0 Points

You are a database developer of a Microsoft SQL Server database. The database contains a table named
Customers that has the following definition:

You need to ensure that the CustomerId column in the Orders table contains only values that exist in the
CustomerId column of the Customer table. Which Transact-SQL statement should you use?

A. ALTER TABLE Customer


ADD CONSTRAINT FK_Customer_CustomerID FOREIGN KEY {CustomerID)
REFERENCES Orders (CustomerId)
B. ALTER TABLE Orders
ADD CONSTRAINT CK_Crders_CustomerID
CHECK (CustomerId IN (SELECT CustomerId FROM Customer))

C. ALTER TABLE Customer


ADD OrderId INT NOT NULL;
D. ALTER TABLE Customer
ADD CONSTRAINT FK_Customer_OrderID FOREIGN KEY (CrderlD) REFERENCES
Orders (CrderlD);
ALTER TABLE Orders
ADD CONSTRAINT PK Orders CustomerId PRIMARY KEY (CustomerID)
E. ALTER TABLE Orders
ADD CONSTRAINT FX_Orders_CustomerID FOREIGN KEY (CustomerId)
REFERENCES Customer (CustomerId)

Question 12 of 20

5.0/ 5.0 Points

Which of the following is an appropriate explanation concerning functions of keywords in SQL?

A. INDEX is a special way to join two or more tables.

B. LIKE is used along with JOIN clause.

C. HAVING specifies a search condition for an aggregate or a group.

D. VALUES is used to sort the data in ascending or descending order.

5.0/ 5.0 Points


Question 13 of 20

Given below data in the Leased_Apartment_Table table

If the following statement is executed, which data group is extracted?


SELECT Property FROM Leased_Apartment_Table
WHERE (District=Tu Liem OR Time_From_The_Station<15) AND
(Floor_Space>60)

A. A, C, D, E

B. A

C. A, C

D. B, D, E

Question 14 of 20

0.0/ 5.0 Points

Which SQL gain table B from table A?

A. SELECT department_code, employee_ID, name FROM A ORDER BY


department_code
B. SELECT department_code, employee_ID, name FROM A GROUP BY

department_code
C. SELECT department_code, employee_ID, name FROM A GROUP BY
employee_ID
D. SELECT department_code, employee_ID, name FROM A ORDER BY
employee_ID
Question 15 of 20

5.0/ 5.0 Points

SQL can be used to:

A. create database structures only.

B. query database data only.

C. modify database data only.

D. All of the above can be done by SQL.

Question 16 of 20

5.0/ 5.0 Points

You are a database developer of a Microsoft SQL Server 2012 database. You are designing a table that will
store Customer data from different sources. The table will include a column that contains the CustomerID
from the source system and a column that contains the SourceID. A sample of this data is as shown in the
following table.

You need to ensure that the table has no duplicate CustomerID within a SourceID. You also need to
ensure that the data in the table is in the order of SourceID and then CustomerID. Which Transact- SQL
statement should you use?

A. CREATE TABLE Customer


(
SourceID int NOT NULL IDENTITY,
CustomerID int NOT NULL IDENTITY,
CustomerName varchar(255) NOT NULL
);
B. CREATE TABLE Customer
(
SourceID int NOT NULL,
CustomerID int NOT NULL PRIMARY KEY CLUSTERED,
CustomerName varchar(255) NOT NULL
);
C. CREATE TABLE Customer
(
SourceID int NOT NULL,
CustomerID int NOT NULL,
CustomerName varchar(255) NOT NULL,
CONSTRAINT PK_Customer PRIMARY KEY CLUSTERED
(SourceID, CustomerID)
);
D. CREATE TABLE Customer
(
SourceID int NOT NULL PRIMARY KEY CLUSTERED,
CustomerID int NOT NULL UNIQUE,
CustomerName varchar(255) NOT NULL
);

5.0/ 5.0 Points


Question 17 of 20

Which of the following is a legal expression in SQL?

A. SELECT NAME FROM EMPLOYEE;

B. None of the above

C. SELECT NULL FROM EMPLOYEE;

D. SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL;

Question 18 of 20

5.0/ 5.0 Points

The statement in SQL which allows change the definition of a table is:

A. Alter.

B. Select

C. Update.

D. Create.

Question 19 of 20
Which of the following SQL statements defines a schema?

5.0/ 5.0 Points

A. CREATE

B. SELECT

C. DELETE

D. INSERT

Question 20 of 20

5.0/ 5.0 Points

AS clause is used in SQL for:

A. Projection operation.

B. Selection operation.

C. Rename operation.

D. Join operation.

Question 1 of 20
SQL data definition commands make up a(n) ________________ .

A. XML

5.0/ 5.0 Points

B. DDL

C. DML

D. HTML

Question 2 of 20

5.0/ 5.0 Points

Which of the following aggregate functions does not ignore nulls in its results?.

A. MAX

B. MIN

C. COUNT.

D. COUNT (*)

Question 3 of 20

5.0/ 5.0 Points

A primary key is combined with a foreign key creates:

A. of the above.

B. Parent-Child relationship between the tables that connect them.

C. Many to many relationship between the tables that connect them.

D. Network model between the tables that connect them.

Question 4 of 20

5.0/ 5.0 Points

DML is provided for:

A. Manipulation & processing of database.

B. Description of logical structure of database.

C. Definition of physical structure of database system.

D. Addition of new structures in the database system.

Question 5 of 20
Which of the following is a comparison operator in SQL?

A. =

B. LIKE

C. BETWEEN

5.0/ 5.0 Points

D. All of the above

Question 6 of 20

5.0/ 5.0 Points

Which of the following is not the SQL statement?

A. INSERT

B. DELETE

C. DIVIDE

D. CREATE

Question 7 of 20

5.0/ 5.0 Points

There is a table including the data items shown below. Which of the following SQL statements should be used
to insert a new row in the student table?
\

A. INSERT INTO student (stud_id, address, name, graduation)


VALUES (101, 100 Happy Lane, Dave, 2001-06-14);
B. INSERT INTO student VALUES (101, Dave, 100 Happy Lane, 2001-06-14);

C. INSERT INTO student VALUES (101, 100 Happy Lane, 2001-06-14, Dave);

D. INSERT INTO student (stud_id, name, graduation) VALUES (101, Dave,


2001-06-14);
Question 8 of 20

5.0/ 5.0 Points

The ______ operator is used to compare a value to a list of literals values that have been specified.

A. BETWEEN

B. ALL

C. ANY

D. IN

Question 9 of 20

0.0/ 5.0 Points

Which of the following two descriptions on the operation of the stated customer_table is wrong?

Operation 1: SELECT CUSTOMER_NAME, ADDRESS FROM CUSTOMER


Operation 2: SELECT * FROM CUSTOMER WHERE CUSTOMER_NO = D0010

A. The table extracted by operation 2 has two columns

B. The table extracted by operation 1 has two columns

C. The table extracted by operation 1 has four rows

D. Operation 1 is PROJECTION and operation 2 is SELECTION

Question 10 of 20

5.0/ 5.0 Points

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

A. View never contains derived columns.

B. View is a virtual table.

C. View is derived from other tables.

D. A view definition is permanently stored as part of the database

Question 11 of 20

5.0/ 5.0 Points

You are a database developer of a Microsoft SQL Server database. The database contains a table named
Customers that has the following definition:

You need to ensure that the CustomerId column in the Orders table contains only values that exist in the
CustomerId column of the Customer table. Which Transact-SQL statement should you use?

A. ALTER TABLE Customer


ADD CONSTRAINT FK_Customer_CustomerID FOREIGN KEY {CustomerID)
REFERENCES Orders (CustomerId)
B. ALTER TABLE Orders
ADD CONSTRAINT CK_Crders_CustomerID
CHECK (CustomerId IN (SELECT CustomerId FROM Customer))
C. ALTER TABLE Customer
ADD OrderId INT NOT NULL;
D. ALTER TABLE Customer
ADD CONSTRAINT FK_Customer_OrderID FOREIGN KEY (CrderlD) REFERENCES
Orders (CrderlD);
ALTER TABLE Orders
ADD CONSTRAINT PK Orders CustomerId PRIMARY KEY (CustomerID)
E. ALTER TABLE Orders
ADD CONSTRAINT FX_Orders_CustomerID FOREIGN KEY (CustomerId) REFERENCES
Customer (CustomerId)

Question 12 of 20

5.0/ 5.0 Points

Which of the following is an appropriate explanation concerning functions of keywords in SQL?

A. INDEX is a special way to join two or more tables.

B. LIKE is used along with JOIN clause.

C. HAVING specifies a search condition for an aggregate or a group.

D. VALUES is used to sort the data in ascending or descending order.

Question 13 of 20

5.0/ 5.0 Points

Given below data in the Leased_Apartment_Table table

If the following statement is executed, which data group is extracted?


SELECT Property FROM Leased_Apartment_Table
WHERE (District=Tu Liem OR Time_From_The_Station<15) AND
(Floor_Space>60)

A. A, C, D, E

B. A

C. A, C

D. B, D, E

Question 14 of 20
Which SQL gain table B from table A?

0.0/ 5.0 Points

A. SELECT department_code, employee_ID, name FROM A ORDER BY


department_code
B. SELECT department_code, employee_ID, name FROM A GROUP BY
department_code
C. SELECT department_code, employee_ID, name FROM A GROUP BY
employee_ID
D. SELECT department_code, employee_ID, name FROM A ORDER BY
employee_ID
Question 15 of 20

5.0/ 5.0 Points

SQL can be used to:

A. create database structures only.

B. query database data only.

C. modify database data only.

D. All of the above can be done by SQL.

5.0/ 5.0 Points


Question 16 of 20

You are a database developer of a Microsoft SQL Server 2012 database. You are designing a table that will
store Customer data from different sources. The table will include a column that contains the CustomerID from
the source system and a column that contains the SourceID. A sample of this data is as shown in the following
table.

You need to ensure that the table has no duplicate CustomerID within a SourceID. You also need to
ensure that the data in the table is in the order of SourceID and then CustomerID. Which Transact- SQL
statement should you use?

A. CREATE TABLE Customer


(
SourceID int NOT NULL IDENTITY,
CustomerID int NOT NULL IDENTITY,
CustomerName varchar(255) NOT NULL
);
B. CREATE TABLE Customer
(
SourceID int NOT NULL,
CustomerID int NOT NULL PRIMARY KEY CLUSTERED,
CustomerName varchar(255) NOT NULL
);
C. CREATE TABLE Customer
(
SourceID int NOT NULL,
CustomerID int NOT NULL,
CustomerName varchar(255) NOT NULL,
CONSTRAINT PK_Customer PRIMARY KEY CLUSTERED
(SourceID, CustomerID)
);

D. CREATE TABLE Customer


(
SourceID int NOT NULL PRIMARY KEY CLUSTERED,
CustomerID int NOT NULL UNIQUE,
CustomerName varchar(255) NOT NULL
);

Question 17 of 20

5.0/ 5.0 Points

Which of the following is a legal expression in SQL?

A. SELECT NAME FROM EMPLOYEE;

B. None of the above

C. SELECT NULL FROM EMPLOYEE;

D. SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL;

Question 18 of 20
The statement in SQL which allows change the definition of a table is:

A. Alter.

B. Select

5.0/ 5.0 Points

C. Update.

D. Create.

Question 19 of 20

5.0/ 5.0 Points

Which of the following SQL statements defines a schema?

A. CREATE

B. SELECT

C. DELETE

D. INSERT

Question 20 of 20
AS clause is used in SQL for:

A. Projection operation.

B. Selection operation.

C. Rename operation.

5.0/ 5.0 Points

D. Join operation.

Question 1 of 20

5.0/ 5.0 Points

Which of the following aggregate functions does not ignore nulls in its results?.

A. COUNT.

B. MAX

C. COUNT (*)

D. MIN

Question 2 of 20

5.0/ 5.0 Points

Which of the following product groups can be found when searching the Product Inventory table for products
with a sales price of 500 dollars or more per unit and an inventory of less than 10 units?

A. Large refrigerator, medium refrigerator, small refrigerator, air purif ier, and
air conditioner
B. Medium refrigerator, small refrigerator, portable refrigerator, coffee maker,
and air conditioner

C. Large refrigerator, medium refrigerator, small refrigerator, portable


refrigerator, air purifier, coffee maker, and air conditioner
D. Medium refrigerator, small refrigerator, and air conditioner

Question 3 of 20

0.0/ 5.0 Points

Which of the following operations extracts specific columns from tables in a relational database?

A. Projection

B. Union

C. Selection

D. Join

Question 4 of 20
Which one of the following is not true for a view?

A. View is derived from other tables.

B. View is a virtual table.

C. A view definition is permanently stored as part of the database

5.0/ 5.0 Points

D. View never contains derived columns.

Question 5 of 20

0.0/ 5.0 Points

You develop a database for a travel application. You need to design tables and other database objects. You
create a view that displays the dates and times of the airline schedules on a report. You need to display dates
and times in several international formats. What should you do?

A. Use the DATETIME2 data type.

B. Use the DATE data type.

C. Use the CAST function.

D. Use the DATETIME data type.

E. Use the FORMAT function.

Question 6 of 20

5.0/ 5.0 Points

Which of the following operation is used if we are interested in only certain columns of a table?

A. SELECTION

B. UNION

C. PROJECTION

D. JOIN

Question 7 of 20

5.0/ 5.0 Points

Which of the following is a legal expression in SQL?

A. None of the above

B. SELECT NAME FROM EMPLOYEE WHERE SALARY = NULL;

C. SELECT NAME FROM EMPLOYEE;

D. SELECT NULL FROM EMPLOYEE;

Question 8 of 20

0.0/ 5.0 Points

Which of the following SQL statements for the stated table Shipment_Record produces the largest value as a
result of its execution?

A. SELECT MAX(quantity) FROM shipment_record

B. SELECT SUM(quantity) FROM shipment_record WHERE date=19991011

C. SELECT AVG(quantity) FROM shipment_record

D. SELECT COUNT(*) FROM shipment_record

Question 9 of 20

5.0/ 5.0 Points

Given below data in the Leased_Apartment_Table table

If the following statement is executed, which data group is extracted?


SELECT Property FROM Leased_Apartment_Table
WHERE (District=Tu Liem OR Time_From_The_Station<15) AND
(Floor_Space>60)

A. A, C, D, E

B. A, C

C. B, D, E

D. A

Question 10 of 20
Count function in SQL returns the number of :

A. Values

5.0/ 5.0 Points

B. Groups

C. Distinct values

D. Columns

Question 11 of 20

5.0/ 5.0 Points

DML is provided for:

A. Description of logical structure of database.

B. Manipulation & processing of database.

C. Addition of new structures in the database system.

D. Definition of physical structure of database system.

Question 12 of 20

5.0/ 5.0 Points

The ______ operator is used to compare a value to a list of literals values that have been specified.

A. BETWEEN

B. ANY

C. ALL

D. IN

Question 13 of 20

5.0/ 5.0 Points

Which of the following is an appropriate explanation concerning functions of keywords in SQL?

A. LIKE is used along with JOIN clause.

B. INDEX is a special way to join two or more tables.

C. HAVING specifies a search condition for an aggregate or a group.

D. VALUES is used to sort the data in ascending or descending order.

Question 14 of 20
SQL data definition commands make up a(n) ________________ .

A. XML

B. DML

C. DDL

5.0/ 5.0 Points

D. HTML

Question 15 of 20

5.0/ 5.0 Points

Which of the following is the appropriate SQL statement that is used to create Table A from Persons Table?

A. SELECT name FROM Persons WHERE country LIKE '%Korea%' OR gender = '
F' AND age = 26
B. SELECT name FROM Persons WHERE country LIKE '%Korea%' AND gender =
'F' OR age = 26
C. SELECT name FROM Persons WHERE country LIKE '%Korea%' AND gender =
'F' AND age = 26
D. SELECT name FROM Persons WHERE country LIKE '%Korea%' OR gender =
'F' OR age = 26
Question 16 of 20

0.0/ 5.0 Points

Which SQL gain table B from table A?

A. SELECT department_code, employee_ID, name FROM A GROUP BY

employee_ID
B. SELECT department_code, employee_ID, name FROM A GROUP BY
department_code
C. SELECT department_code, employee_ID, name FROM A ORDER BY
employee_ID
D. SELECT department_code, employee_ID, name FROM A ORDER BY
department_code
Question 17 of 20

5.0/ 5.0 Points

Which of the following two descriptions on the operation of the stated customer_table is wrong?

Operation 1: SELECT CUSTOMER_NAME, ADDRESS FROM CUSTOMER


Operation 2: SELECT * FROM CUSTOMER WHERE CUSTOMER_NO = D0010

A. The table extracted by operation 1 has four rows

B. The table extracted by operation 1 has two columns

C. Operation 1 is PROJECTION and operation 2 is SELECTION

D. The table extracted by operation 2 has two columns

Question 18 of 20

5.0/ 5.0 Points

You are a database developer of a Microsoft SQL Server 2012 database. You are designing a table that will

store Customer data from different sources. The table will include a column that contains the CustomerID from
the source system and a column that contains the SourceID. A sample of this data is as shown in the following
table.

You need to ensure that the table has no duplicate CustomerID within a SourceID. You also need to
ensure that the data in the table is in the order of SourceID and then CustomerID. Which Transact- SQL
statement should you use?

A. CREATE TABLE Customer


(
SourceID int NOT NULL,
CustomerID int NOT NULL,
CustomerName varchar(255) NOT NULL,
CONSTRAINT PK_Customer PRIMARY KEY CLUSTERED
(SourceID, CustomerID)
);
B. CREATE TABLE Customer
(
SourceID int NOT NULL,
CustomerID int NOT NULL PRIMARY KEY CLUSTERED,
CustomerName varchar(255) NOT NULL
);
C. CREATE TABLE Customer
(
SourceID int NOT NULL PRIMARY KEY CLUSTERED,
CustomerID int NOT NULL UNIQUE,
CustomerName varchar(255) NOT NULL
);

D. CREATE TABLE Customer


(
SourceID int NOT NULL IDENTITY,
CustomerID int NOT NULL IDENTITY,
CustomerName varchar(255) NOT NULL
);

Question 19 of 20

5.0/ 5.0 Points

Which of the following SQL statements can extract employee names whose salary is $10000 or higher from
the table human_resource?

A. SELECT salary FROM human_resource WHERE employee_name >=10000


GROUP BY salary
B. SELECT employee_name FROM human_resource WHERE salary>=10000

C. SELECT employee_name, salary FROM human_resource


GROUP BY salary HAVING COUNT(*)>=10000
D. SELECT employee_name, COUNT(*) FROM human_resource
WHERE salary>=10000 GROUP BY employee_name

Question 20 of 20
The statement in SQL which allows change the definition of a table is:

A. Select

5.0/ 5.0 Points

B. Update.

C. Alter.

D. Create.

Anda mungkin juga menyukai