MORE_SQL_2024
MORE_SQL_2024
Answer: a
Explanation: Table name should not start with numerical value as per naming
convention in T-SQL.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate
Now!
advertisement
SELECT course_id
FROM instructor JOIN teaches;
View Answer
Answer: b
Explanation: Join clause joins two tables by matching the common column.
Answer: d
Explanation: Here * is used to select all the fields of the relation.
4. Which of the following statements contains an error?
a)
SELECT empid
FROM emp
WHERE empid = 10006;
c) Select empid from emp;
d)
SELECT empid
WHERE empid = 1009 AND lastname = ‘GELLER’;
View Answer
Answer: d
Explanation: This query do not have from clause which specifies the relation from
which the values has to be selected.
Answer: b
Explanation: Value keyword has to be used to insert the values into the table.
6. To delete a database ___________ command is used.
a) Delete database database_name
b) Delete database_name
c) drop database database_name
d) drop database_name
View Answer
Answer: c
Explanation: This will delete the database with its structure.
7. The ________________ is essentially used to search for patterns in target
string.
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate
View Answer
Answer: a
Explanation: Like matches the pattern with the query.
8. Which is a duplicate copy of a file program that is stored on a different
storage media than the original location?
a) Concurrency
b) Deadlock
c) Backup
d) Recovery
View Answer
Answer: c
Explanation: Backup is required to protect the data.
9. _______________ joins are SQL server default.
a) Outer
b) Inner
c) Equi
d) None of the Mentioned
View Answer
Answer: b
Explanation: Inner query joins only the rows that are matching.
10. To alter a database ___________ command is used.
a) ALTER database database_name
b) ALTER database_name
c) ALTER database database_name
d) ALTER database_name
View Answer
Answer: c
Explanation: ALTER Statement will alter the database structure and its related
functionalities.
Q.
Which of the following is an aggregate function in SQL?
A. Union
B. Like
C. Group By
D. Max
Answer D
B. AVG
C. JOIN
D. LEN
Answer: Option B
SELECT T2.name
FROM
category T1JOIN category T2
ON
T2.parent = T1.id
WHERE
T1.name = 'Kitchen'
1. Aggregate functions are functions that take a ___________ as input and return a
single value.
a) Collection of values
b) Single value
c) Aggregate value
d) Both Collection of values & Single value
View Answer
Answer: a
Explanation: None.
2.
SELECT __________
FROM instructor
WHERE dept name= ’Comp. Sci.’;
Which of the following should be used to find the mean of the salary ?
a) Mean(salary)
b) Avg(salary)
c) Sum(salary)
d) Count(salary)
View Answer B
3.
4. All aggregate functions except _____ ignore null values in their input
collection.
a) Count(attribute)
b) Count(*)
c) Avg
d) Sum
View Answer
Answer: b
Explanation: * is used to select all values including null.
5. A Boolean data type that can take values true, false, and________
a) 1
b) 0
c) Null
d) Unknown
View Answer
Answer: d
Explanation: Unknown values do not take null value but it is not known.
6. The ____ connective tests for set membership, where the set is a collection of
values produced by a select clause. The ____ connective tests for the absence of
set membership.
a) Or, in
b) Not in, in
c) In, not in
d) In, or
View Answer
Answer: c
Explanation: In checks, if the query has the value but not in checks if it does not
have the value.
7. Which of the following should be used to find all the courses taught in the Fall
2009 semester but not in the Spring 2010 semester .
a)
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)
d)
Answer: d
Explanation: >some takes atlest one value above it .
9. Which of the following is used to find all courses taught in both the Fall 2009
semester and in the Spring 2010 semester .
a)
SELECT course id
FROM SECTION AS S
WHERE semester = ’Fall’ AND YEAR= 2009 AND
EXISTS (SELECT *
FROM SECTION AS T
WHERE semester = ’Spring’ AND YEAR= 2010 AND
S.course id= T.course id);
b)
SELECT name
FROM instructor
WHERE salary > SOME (SELECT salary
FROM instructor
WHERE dept name = ’Biology’);
c)
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)
View Answer
Answer: a
Explanation: None.
10. We can test for the nonexistence of tuples in a subquery by using the _____
construct.
a) Not exist
b) Not exists
c) Exists
d) Exist
View Answer
Answer: b
The ____ connective tests for set membership, where the set is a collection
of values produced by a select clause. The ____ connective tests for the absence of
set membership.
A. In, not in
B. In, or
C. Not in, in
D. Or, in
Answer A
You have founded a new company with two friends. Your new application (app) uses a
SQL Server database to store information. You are unsure whether your app will be
successful but, if it is, you will need both high performance and space for large
volumes of data. However, you have not yet launched, so are unsure how many people
will use your app. Which edition of SQL Server should you use for this system?
2) Enterprise edition
3) Express edition
This version allows you to start small, and scale up as required. As a startup,
using Azure SQL Database also means you do not need to buy server hardware to run
SQL Server. Because Azure SQL Database is Software as a Service (SaaS), you pay for
what you use, without high upfront costs.
A colleague has asked you to run some test queries against the company's scheduling
database. Administrators have given you the name of the server where the database
is hosted, and the name of the database. Permissions to run the necessary queries
have been granted to your Active Directory® account. You are logged on to a client
computer with this Active Directory account and have started SQL Server Management
Studio. What other information do you need to connect to the database?
3) The name of the login created for you in the SQL Server instance.
5) The name of the user created for you in the SQL Server database.
4) The name of the instance that hosts the database.
You do not need to provide your Active Directory credentials because these will be
sent to SQL Server automatically when you connect. This account has been associated
with a login and user in SQL Server by database administrators when they granted
access to your account. However, unless the database is on the default instance,
you must specify which instance to connect to.
Can a SQL Server database be stored across multiple instances?
No. A database is completely contained within a single instance.
FROM HumanResources.Employees
JOIN HumanResources.Employers
ON HumanResources.Employees.EmployerID = HumanResources.Employers.ID;
Always remember to consider the readability of T-SQL queries because clear queries
can help to avoid coding mistakes and bugs.
inner join
Only returns matched records from the tables that are being joined
outer join
A join in which rows that do not have matching values in common columns are
nevertheless included in the result table.
cross join
A join in which each row from one table is combined with each row from another
table.
You have a table named PoolCars and a table named Bookings in your
ResourcesScheduling database. You want to return all the pool cars for which there
are zero bookings. Which of the following queries should you use?
--
FROM ResourcesScheduling.PoolCars AS pc
RIGHT OUTER JOIN ResourcesScheduling.Bookings AS b
ON pc.ID = b.CarID;
--
FROM ResourcesScheduling.PoolCars AS pc
JOIN ResourcesScheduling.Bookings AS b
ON pc.ID = b.CarID;
--
FROM ResourcesScheduling.PoolCars AS pc
ON pc.ID = b.CarID
If a pool car has no bookings, there will be no rows in the Bookings table for that
matching CarID. When you perform a LEFT OUTER JOIN for Bookings to PoolCars, your
results include all cars and all bookings for those cars. Because it is a LEFT
JOIN, all cars are included even if they have no bookings. Those records, in the
result set, have null values for the BookingID. By testing for these null values in
the WHERE clause, you can filter out all cars with bookings and leave only those
cars with no bookings.
You have two tables named FirstNames and LastNames. You want to generate a set of
fictitious full names from this data. There are 150 entries in the FirstNames table
and 250 entries in the LastNames table. You use the following query:
FROM FirstNames AS f
You have a table named Sales with the following columns: Country, NumberOfReps,
TotalSales.You want to find out the average amount of sales a sales representative
makes in each country. What SELECT query could you use?
SELECT Country, (TotalSales / NumberOfReps) AS AverageSalesPerRep
FROM Sales;
You can use a calculation from two columns in the Sales table to determine the
average amount of sales per representative.
you have company departments in five countries. You have the following query for
the Human Resources database:
FROM HumanResources.Departments
This returns:
DeptName Country
--------- --------
Sales UK
Sales USA
Sales France
Sales Japan
Marketing USA
Marketing Japan
Research USA
Which of the following statements use correct column aliases? (select all that
apply)
1.
2.
3.
4.
5.
Statement 2 is trying to assign the alias name to the column, which is incorrect.
Statement 3 uses the double equals sign, which is not correct syntax in the T-SQL
programming language.
Statement 5 is almost correct. However, there is a space between the two words in
the alias, which will work if it is corrected to be [Product Name] or 'Product
Name'.
FROM HumanResources.Employees;
You are surprised to find that the query returns the following:
LastName
---------
Fred
Rosalind
Anil
Linda
FROM HumanResources.Employees;
This returns:
Maya Steele 1
Adam Brookes 0
Naomi Sharp 1
Pedro Fielder 0
Zachary Parsons 0
2) Query is exposed to changes in the underlying table structure and could return
unexpected results.
From the following T-SQL elements, select the one that does not contain an
expression:
SQL expression
A formula or set of values that determines the exact results of an SQL query.
From the following T-SQL elements, select the one that can include a predicate:
WHERE clauses
JOIN conditions
HAVING clauses
WHILE statements
WHERE clauses use predicates to determine which rows to return. JOIN conditions use
predicates to determine which rows from different tables to join into a single
result row. HAVING clauses use predicates to determine which groups to return.
WHILE statements use predicates to determine when to stop executing T-SQL
statements in a batch.
SQL Predicate
ALL, ANY, BETWEEN, IN, LIKE, OR, SOME
Put the following T-SQL elements in order by numbering each to indicate the order
that SQL Server will process them in when they appear in a single SELECT statement.
GROUP BY
HAVING
FROM
WHERE
SELECT
ORDER BY
(this is the order in which SQL executes, not the order in which you write it)
A:
1) FROM
2) WHERE
3) GROUP BY
4) HAVING
5) SELECT
6) ORDER BY
what are the 5 system databases that SQL server comes with?
master: the system configuration database.
model: the template database. SQL Server will apply any changes made in model to
new databases.
tempDb: a temporary store for data such as work tables. This database is dropped
and
recreated each time SQL Server restarts, which means that any temporary tables will
be lost when SQL Server closes down.
resource: a hidden, read-only database that contains all the system objects for
other databases.
Answer: d
Explanation: All the mentioned commands are the part of DDL statements.
3. In SQL, which command(s) is(are) used to change a table’s storage
characteristics?
a) ALTER TABLE
b) MODIFY TABLE
c) CHANGE TABLE
d) All of the Mentioned
View Answer
Answer: a
Explanation: To change the structure of the table we use ALTER TABLE Syntax:
ALTER TABLE “table_name” ADD “column_name” datatype
OR
ALTER TABLE “table_name” DROP COLUMN “column_name”.
Subscribe Now: Oracle Database Newsletter | Important Subjects Newsletters
advertisement
4. In SQL, which of the following is not a data definition language commands?
a) RENAME
b) REVOKE
c) GRANT
d) UPDATE
View Answer
Answer: a
Explanation: With RENAME statement you can rename a table.RENAME, REVOKE and GRANT
are DDL commands and UPDATE is DML command.
5. ________clause is an additional filter that is applied to the result.
a) Select
b) Group-by
c) Having
d) Order by
View Answer
Answer: c
Explanation: The HAVING clause was added to SQL because the WHERE keyword could not
be used with aggregate functions.
Check this: Information Technology Books | Oracle Database Books
6. ___________ defines rules regarding the values allowed in columns and is the
standard mechanism for enforcing database integrity.
a) Column
b) Constraint
c) Index
d) Trigger
View Answer
Answer: b
Explanation: SQL constraints are used to specify rules for the data in a table.If
there is any violation between the constraint and the data action, the action is
aborted by the constraint.
7. SQL has how many main commands for DDL:
a) 1
b) 2
c) 3
d) 4
View Answer
Answer: c
Explanation: Create, Delete, Alter these are 3 main command.
8. Which command defines its columns, integrity constraint in create table:
a) Create command
b) Drop table command
c) Alter table command
d) All of the Mentioned
View Answer
Answer: a
Explanation: The CREATE TABLE statement is used to create a table in a
database.Tables are organized into rows and columns.
9. Which command is used for removing a table and all its data from the database:
a) Create command
b) Drop table command
c) Alter table command
d) All of the Mentioned
View Answer
Answer: b
Explanation: The DROP INDEX statement is used to delete an index in a table.
10. Which command allows the removal of all rows from a table but flushes a table
more efficiently since no rollback information is retained:
a) TRUNCATE command
b) Create command
c) Drop table command
d) Alter table command
View Answer
Answer: a
Explanation: The SQL TRUNCATE TABLE command is used to delete complete data from an
existing
table.You can also use DROP TABLE command to delete complete table but it would
remove complete table structure
form the database and you would need to re-create this table once again if you wish
you store some data.
1. What type of join is needed when you wish to include rows that do not have
matching values?
a) Equi-join
b) Natural join
c) Outer join
d) All of the Mentioned
View Answer
Answer: c
Explanation:OUTER JOIN is the only join which shows the unmatched rows.
2. What type of join is needed when you wish to return rows that do have matching
values?
a) Equi-join
b) Natural join
c) Outer join
d) All of the Mentioned
View Answer
Answer: d
Explanation: Outer join returns the row having matching as well as non matching
values.
3. Which of the following is one of the basic approaches for joining tables?
a) Subqueries
b) Union Join
c) Natural join
d) All of the Mentioned
View Answer
Answer: d
Explanation: The SQL subquery is a SELECT query that is embedded in the main SELECT
statement. In many cases, a subquery can be used instead of a JOIN.
Note: Join free Sanfoundry classes at Telegram or Youtube
advertisement
Answer: a
Explanation: Equi-join joins only same data entry field. For example, one table
contains department id and another table should contain department id.
5. A UNION query is which of the following?
a) Combines the output from no more than two queries and must include the same
number of columns
b) Combines the output from no more than two queries and does not include the same
number of columns
c) Combines the output from multiple queries and must include the same number of
columns
d) Combines the output from multiple queries and does not include the same number
of columns
View Answer
Answer: c
Explanation: A single UNION can combine only 2 sql query at a time.
Take SQL Server Tests Now!
6. 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
View Answer
Answer: a
Explanation: Subquery—also referred to as an inner query or inner select—is a
SELECT statement embedded within a data manipulation language (DML) statement or
nested within another subquery.
7. 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
View Answer
Answer: a
Explanation: A ‘correlated subquery’ is a term used for specific types of queries
in SQL in computer databases. It is a subquery (a query nested inside another
query) that uses values from the outer query in its WHERE clause.
8. How many tables may be included with a join?
a) One
b) Two
c) Three
d) All of the Mentioned
View Answer
Answer: d
Explanation: Join can be used for more than one table. For ‘n’ tables the no of
join conditions required are ‘n-1’.
9. The following SQL is which type of join: SELECT CUSTOMER_T. CUSTOMER_ID,
ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM CUSTOMER_T,ORDER_T?
a) Equi-join
b) Natural join
c) Outer join
d) Cartesian join
View Answer
Answer: d
Explanation: Cartesian Join is simply the joining of one or more table which
returns the product of all the rows in these tables.
10. Which is not a type of join in T-SQL?
a) Equi-join
b) Natural join
c) Outer join
d) Cartesian join
View Answer
Answer: b
Explanation: A NATURAL JOIN is an inner join where the RDBMS automatically selects
the
join columns based on common columns names. Some RDBMS
vendors, like Oracle but not SQL Server, implement a NATURAL JOIN operator.
1. The query given below will give an error. Which one of the following has to be
replaced to get the desired output?
Answer: a
Explanation: Table name should not start with numerical value as per naming
convention in T-SQL.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate
Now!
advertisement
SELECT course_id
FROM instructor JOIN teaches;
View Answer
Answer: b
Explanation: Join clause joins two tables by matching the common column.
Answer: d
Explanation: Here * is used to select all the fields of the relation.
4. Which of the following statements contains an error?
a)
SELECT empid
FROM emp
WHERE empid = 10006;
c) Select empid from emp;
d)
SELECT empid
WHERE empid = 1009 AND lastname = ‘GELLER’;
View Answer
Answer: d
Explanation: This query do not have from clause which specifies the relation from
which the values has to be selected.
5. Insert into employee _________ (1002,Joey,2000);
In the given query which of the keyword has to be inserted?
a) Table
b) Values
c) Relation
d) Field
View Answer
Answer: b
Explanation: Value keyword has to be used to insert the values into the table.
6. To delete a database ___________ command is used.
a) Delete database database_name
b) Delete database_name
c) drop database database_name
d) drop database_name
View Answer
Answer: c
Explanation: This will delete the database with its structure.
7. The ________________ is essentially used to search for patterns in target
string.
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate
View Answer
Answer: a
Explanation: Like matches the pattern with the query.
8. Which is a duplicate copy of a file program that is stored on a different
storage media than the original location?
a) Concurrency
b) Deadlock
c) Backup
d) Recovery
View Answer
Answer: c
Explanation: Backup is required to protect the data.
9. _______________ joins are SQL server default.
a) Outer
b) Inner
c) Equi
d) None of the Mentioned
View Answer
Answer: b
Explanation: Inner query joins only the rows that are matching.
10. To alter a database ___________ command is used.
a) ALTER database database_name
b) ALTER database_name
c) ALTER database database_name
d) ALTER database_name
View Answer
Answer: c
1. Is “GROUP BY” clause is similar to “ORDER BY” clause?
a) Yes
b) No
c) Depends
d) None of the mentioned
View Answer
Answer: b
Explanation: “ORDER BY” clause is used for sorting while “GROUP BY” clause is used
for aggregation of fields.
2. What is the meaning of “ORDER BY” clause in Mysql?
a) Sorting your result set using column data
b) Aggregation of fields
c) Sorting your result set using row data
d) None of the mentioned
View Answer
Answer: a
Explanation: None.
3. What is the significance of “ORDER BY” in the following MySQL statement?
Answer: a
Explanation: Sorting in ascending or descending order depends on keyword “DESC” and
“ASC”.
Participate in MySQL Certification Contest of the Month Now!
4. What will be the order of sorting in the following MySQL statement?
Answer: a
Explanation: In the query, first “emp_id” will be sorted then emp_name with respect
to emp_id.
5. If emp_id contain the following set {9, 7, 6, 4, 3, 1, 2}, what will be the
output on execution of the following MySQL statement?
SELECT emp_id
FROM person
ORDER BY emp_id;
a) {1, 2, 3, 4, 6, 7, 9}
b) {2, 1, 4, 3, 7, 9, 6}
c) {9, 7, 6, 4, 3, 1, 2}
d) None of the mentioned
View Answer
Answer: a
Explanation: “ORDER BY” clause sort the emp_id in the result set.
6. If emp_id contain the following set {1, 2, 3, 4, 1, 1}, what will be the output
on execution of the following MySQL statement?
SELECT emp_id
FROM person
ORDER BY emp_id;
a) {1, 1, 1, 2, 3, 4}
b) {1, 2, 3, 4, 1, 1}
c) {1, 1, 2, 3, 4, 1}
d) None of the mentioned
View Answer
Answer: a
Explanation: “ORDER BY” clause sort the emp_id in the result set.
7. If emp_id contain the following set {1, 2, 2, 3, 3, 1}, what will be the output
on execution of the following MySQL statement?
SELECT emp_id
FROM person
ORDER BY emp_id;
a) {1, 1, 2, 2, 3, 3}
b) {1, 2, 3, 3, 2, 1}
c) {2, 2, 1, 1, 3, 3}
d) None of the mentioned
View Answer
Answer: a
Explanation: “ORDER BY” clause sort the emp_id in the result set.
8. If emp_id contain the following set {-1, -2, 2, 3, -3, 1}, what will be the
output on execution of the following MySQL statement?
SELECT emp_id
FROM person
ORDER BY emp_id;
a) {-3, -2, -1, 1, 2, 3}
b) {-1, 1, -2, 2, -3, 3}
c) {1, 2, 3, -1, -2, -3}
d) None of the mentioned
View Answer
Answer: a
Explanation: “ORDER BY” clause sort the emp_id in the result set.
9. Which keyword is used for sorting the data in descending order in Mysql?
a) DESC
b) ASC
c) ALTER
d) MODIFY
View Answer
Answer: a
Explanation: None.
10. Which keyword is used for sorting the data in ascending order in Mysql?
a) DESC
b) ASC
c) ALTER
d) MODIFY
View Answer
Answer: b
Explanation: None.
Answer: d
Explanation: In SQL Server, based on their storage characteristics, some data types
are designated as large value data types and large object data types.
2. Data types in SQL Server are organized into how many categories?
a) 6
b) 8
c) 9
d) 10
View Answer
Answer: a
Explanation: SQL Server offers six categories of data types for your use:-exact
numeric, Unicode character strings, approximate numeric, Binary strings, Date and
time and Character strings.
3. Exact Numeric data type is ___________
a) bigint
b) int
c) smallmoney
d) all of the mentioned
View Answer
Answer: d
Explanation: Exact numeric data types store numeric values where you wish to
specify the precision of the variable. They may include integer or decimal numbers.
Note: Join free Sanfoundry classes at Telegram or Youtube
advertisement
Answer: c
Explanation: ntext is fixed and variable-length data type for storing large non-
Unicode and Unicode character.
5. A column of type __________ may contain rows of different data types.
a) ntext
b) date
c) smallmoney
d) sql_variant
View Answer
Answer: d
Explanation: sql_variant is data type that stores values of various SQL Server-
supported data types.
Take SQL Server Mock Tests - Chapterwise!
Start the Test Now: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
6. You want to track date and time of the last write access per row?
a) Add TIMESTAMP column to the table
b) Add a DATETIME column to the table and assign getdate() as the default value
c) Add a DATETIME column to the table and write a trigger that sets its value
d) Add a UNIQUEIDENTIFIER column to the table and use it with SQL Server’s built-in
functions
View Answer
Answer: a
Explanation: The correct answer is Add a DATETIME column to the table and write a
trigger that sets its value.
7._________ is a spatial data type.
a) geometry
b) sql_variant
c) cursor
d) all of the mentioned
View Answer
Answer: b
Explanation: SQL Server supports the geometry and geography data types for storing
spatial data. These types support methods and properties that allow for the
creation, comparison, analysis, and retrieval of spatial data.
8. Which of the following data type is not present in SQL Server?
a) bit
b) boolean
c) hierarchyid
d) geography
View Answer
Answer: b
Explanation: SQL Server doesn’t have a Boolean data type, at least not by that
name. To store True/False, Yes/No, and On/Off values, use the bit data type. It
accepts only three values: 0, 1, and NULL.
9. ______________ is monetary data type in SQL Server.
a) Smallmoney
b) sql_variant
c) Cursor
d) None of the Mentioned
View Answer
Answer: a
Explanation: Monetary data types are data types that represent monetary or currency
values such as smallmoney and money.
10. Which of the data type has a storage size of 8 bytes?
a) timestamp
b) uniqueidentifier
c) real
d) smallmoney
View Answer
Answer: a
Explanation: uniqueidentifier, real and smallmoney data types have storage size of
16,4 and 4 bytes respectively.
1. Aggregate functions are functions that take a ___________ as input and return a
single value.
a) Collection of values
b) Single value
c) Aggregate value
d) Both Collection of values & Single value
View Answer
Answer: a
Explanation: None.
2.
SELECT __________
FROM instructor
WHERE dept name= ’Comp. Sci.’;
Which of the following should be used to find the mean of the salary ?
a) Mean(salary)
b) Avg(salary)
c) Sum(salary)
d) Count(salary)
View Answer
Answer: b
Explanation: Avg() is used to find the mean of the values.
Note: Join free Sanfoundry classes at Telegram or Youtube
advertisement
3.
Answer: a
Explanation: Distinct keyword is used to select only unique items from the
relation.
4. All aggregate functions except _____ ignore null values in their input
collection.
a) Count(attribute)
b) Count(*)
c) Avg
d) Sum
View Answer
Answer: b
Explanation: * is used to select all values including null.
5. A Boolean data type that can take values true, false, and________
a) 1
b) 0
c) Null
d) Unknown
View Answer
Answer: d
Explanation: Unknown values do not take null value but it is not known.
6. The ____ connective tests for set membership, where the set is a collection of
values produced by a select clause. The ____ connective tests for the absence of
set membership.
a) Or, in
b) Not in, in
c) In, not in
d) In, or
View Answer
Answer: c
Explanation: In checks, if the query has the value but not in checks if it does not
have the value.
7. Which of the following should be used to find all the courses taught in the Fall
2009 semester but not in the Spring 2010 semester .
a)
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)
d)
Answer: d
Explanation: >some takes atlest one value above it .
9. Which of the following is used to find all courses taught in both the Fall 2009
semester and in the Spring 2010 semester .
a)
SELECT course id
FROM SECTION AS S
WHERE semester = ’Fall’ AND YEAR= 2009 AND
EXISTS (SELECT *
FROM SECTION AS T
WHERE semester = ’Spring’ AND YEAR= 2010 AND
S.course id= T.course id);
b)
SELECT name
FROM instructor
WHERE salary > SOME (SELECT salary
FROM instructor
WHERE dept name = ’Biology’);
c)
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)
View Answer
Answer: a
Explanation: None.
10. We can test for the nonexistence of tuples in a subquery by using the _____
construct.
a) Not exist
b) Not exists
c) Exists
d) Exist
View Answer
Answer: b
Explanation: Exists is used to check for the existence of tuples.
7. A file manipulation command that extracts some of the records from a file is
called
a) SELECT
b) PROJECT
c) JOIN
d) PRODUCT
Answer: A
10. A data manipulation command the combines the records from one or more tables is
called
a) SELECT
b) PROJECT
c) JOIN
d) PRODUCT
Answer: C
11. View the Exhibit and examine the structure of the SALES, CUSTOMERS, PRODUCTS,
and TIMES
tables.
The PROD_ID column is the foreign key in the SALES table, which references the
PRODUCTS table.
Similarly, the CUST_ID and TIME_ID columns are also foreign keys in the SALES table
referencing the
CUSTOMERS and TIMES tables, respectively.
Evaluate the following CREATE TABLE command:
CREATE TABLE new_sales(prod_id, cust_id, order_date DEFAULT SYSDATE)
AS
SELECT prod_id, cust_id, time_id
FROM sales;
Which statement is true regarding the above command?
A. The NEW_SALES table would not get created because the DEFAULT value cannot be
specified in the column definition.
B. The NEW_SALES table would get created and all the NOT NULL constraints defined
on the specified columns would be passed to the new table.
C. The NEW_SALES table would not get created because the column names in the CREATE
TABLE command and the SELECT clause do not match.
D. The NEW_SALES table would get created and all the FOREIGN KEY constraints
defined on the specified columns would be passed to the new table.
Answer: B
12. View the Exhibit to examine the description for the SALES table.
Which views can have all DML operations performed on it? (Choose all that apply.)
A.CREATE VIEW v3 AS SELECT * FROM SALES WHERE cust_id = 2034 WITH CHECK OPTION;
B. CREATE VIEW v1 AS SELECT * FROM SALES WHERE time_id<= SYSDATE - 2*365 WITH CHECK
OPTION;
C. CREATE VIEW v2 AS SELECT prod_id, cust_id, time_id FROM SALES WHERE time_id<=
SYSDATE - 2*365 WITH CHECK OPTION;
Answer: AB
13. You need to extract details of those products in the SALES table where the
PROD_ID column containsthe string '_D123'.Which WHERE clause could be used in the
SELECT statement to get the required output?
A.WHERE prod_id LIKE '%_D123%' ESCAPE '_'
B.WHERE prod_id LIKE '%\_D123%' ESCAPE '\'
C. WHERE prod_id LIKE '%_D123%' ESCAPE '%_'
D. WHERE prod_id LIKE '%\_D123%' ESCAPE '\_'
Answer: B
14. Which two statements are true regarding single row functions? (Choose two.)
A. They accept only a single argument.
B. They can be nested only to two levels.
C. Arguments can only be column values or constants.
D. They always return a single result row for every row of a queried table.
E. They c an return a data type value different from the one that is referenced.
Answer: DE
15. Which SQL statements would display the value 1890.55 as $1,890.55? (Choose
three .)
A. SELECT TO_CHAR(1890.55,'$0G000D00')
FROM DUAL;
B.SELECT TO_CHAR(1890.55,'$9,999V99')
FROM DUAL;
C.SELECT TO_CHAR(1890.55,'$99,999D99')
FROM DUAL;
D.SELECT TO_CHAR(1890.55,'$99G999D00')
FROM DUAL;
E.SELECT TO_CHAR(1890.55,'$99G999D99')
FROM DUAL;
Answer: ADE
SHIPMENT_MODE VARCHAR2(30)
SHIPMENT_COST NUMBER(8,2)
You want to generate a report that displays the PO_ID and the penalty amount to be
paid if the
SHIPMENT_DATE is later than one month from the PO_DATE. The penalty is $20 per day.
FROM shipments;
FROM shipments;
B. Only the first query executes successfully but gives a wrong result.
C. Only the first query executes successfully and gives the correct result.
D. Only the second query executes successfully but gives a wrong result.
E. Only the second query executes successfully and gives the correct result.
Answer: C
17. Which two statements are true regarding the USING and ON clauses in table
joins? (Choose two.)
A. Both USING and ON clauses can be used for equijoins and nonequijoins.
B.A maximum of one pair of columns can be joined between two tables using the ON
clause.
C.The ON clause can be used to join tables on columns that have different names but
compatible data types.
D.The WHERE clause can be used to apply additional conditions in SELECT statements
containing the ON or the USING clause.
Answer: CD
18. View the Exhibit and examine the structure of the CUSTOMERS table.
A. listing of customers who do not have a credit limit and were born before 1980
B. finding the number of customers, in each city, whose marital status is 'married'
D. listing of those customers whose credit limit is the same as the credit limit of
customers residing in the city 'Tokyo'
E. finding the number of customers, in each city, whose credit limit is more than
the average credit limit of all the customers
Answer: DE
D. The number of columns and data types must be identical for all SELECT statements
in the query.
Answer: D
Answer: D
21. View the Exhibit and examine the structure of the PRODUCTS table.
You issue the following command to display the total price of each product after a
discount of 25% and a tax
of 15% are applied on it. Freight charges of $100 have to be applied to all the
products.
+(prod_list_price -(prod_list_price*(25/100))*(15/100))+100
AS "TOTAL PRICE"
FROM products;
What would be the outcome if all the parenthese s are removed from the above
statement?
A.It produces a syntax error.
B.The result remains unchanged.
C.The total price value would be lower than the correct value.
D.The total price value would be higher than the correct value.
Answer: B
Answer: C
24. An application where only one user accesses the database at a given time is an
example of a(n) ________ .
A.single-user database application
B.multiuser database application
C.e-commerce database application
D.data mining database application
Answer: A
Answer: C
Answer: A
27. Helping people keep track of things is the purpose of a(n) ________ .
A.database
B.table
C.instance
D.relationship
Answer: A
28. You have run an SQL statement that asked the DBMS to display data in a table
named USER_TABLES. The results include columns of data labeled "TableName,"
"NumberOfColumns" and "PrimaryKey." You are looking at ________ .
A.user data.
B.metadata
C.A report
D.indexes
Answer: B
29. Every time attribute A appears, it is matched with the same value of attribute
B, but not the same value of attribute C. Therefore, it is true that:
A.A ? B.
B.A ? C.
C.A ? (B,C).
D.(B,C) ? A.
Answer: A
30. The different classes of relations created by the technique for preventing
modification anomalies are called:
A.normal forms.
B.referential integrity constraints.
C.functional dependencies.
D.None of the above is correct.
Answer: A
31. The primary key is selected from the:
A.composite keys.
B.determinants.
C.candidate keys.
D.foreign keys.
Answer: C
32. A functional dependency is a relationship between or among:
A.tables.
B.rows.
C.relations.
D.attributes.
Answer: D
33. View the Exhibit and examine the structure of the SALES, CUSTOMERS, PRODUCTS,
and TIMES tables.
The PROD_ID column is the foreign key in the SALES table, which references the
PRODUCTS table.
Similarly, the CUST_ID and TIME_ID columns are also foreign keys in the SALES table
referencing the
CUSTOMERS and TIMES tables, respectively.
Evaluate the following CREATE TABLE command:
CREATE TABLE new_sales(prod_id, cust_id, order_date DEFAULT SYSDATE)
AS
SELECT prod_id, cust_id, time_id
FROM sales;
Which statement is true regarding the above command?
A. The NEW_SALES table would not get created because the DEFAULT value cannot be
specified in the column definition.
B. The NEW_SALES table would get created and all the NOT NULL constraints defined
on the specified columns would be passed to the new table.
C. The NEW_SALES table would not get created because the column names in the CREATE
TABLE command and the SELECT clause do not match.
D. The NEW_SALES table would get created and all the FOREIGN KEY constraints
defined on the specified columns would be passed to the new table.
Answer: B
34. View the Exhibit to examine the description for the SALES table.
Which views can have all DML operations performed on it? (Choose all that apply.)
A.CREATE VIEW v3 AS SELECT * FROM SALES WHERE cust_id = 2034 WITH CHECK OPTION;
B. CREATE VIEW v1 AS SELECT * FROM SALES WHERE time_id<= SYSDATE - 2*365 WITH CHECK
OPTION;
C. CREATE VIEW v2 AS SELECT prod_id, cust_id, time_id FROM SALES WHERE time_id<=
SYSDATE - 2*365 WITH CHECK OPTION;
D. CREATE VIEW v4 AS SELECT prod_id, cust_id, SUM(quantity_sold) FROM SALES WHERE
time_id<= SYSDATE - 2*365 GROUP BY prod_id, cust_id WITH CHECK OPTION;
Answer: AB
35.You need to extract details of those products in the SALES table where the
PROD_ID column containsthe string '_D123'.Which WHERE clause could be used in the
SELECT statement to get the required output?
A.WHERE prod_id LIKE '%_D123%' ESCAPE '_'
B.WHERE prod_id LIKE '%\_D123%' ESCAPE '\'
C. WHERE prod_id LIKE '%_D123%' ESCAPE '%_'
D. WHERE prod_id LIKE '%\_D123%' ESCAPE '\_'
Answer: B
36. Which two statements are true regarding single row functions? (Choose two.)
A. They accept only a single argument.
B. They can be nested only to two levels.
C. Arguments can only be column values or constants.
D. They always return a single result row for every row of a queried table.
E. They c an return a data type value different from the one that is referenced.
Answer: DE
37. Which SQL statements would display the value 1890.55 as $1,890.55? (Choose
three .)
A. SELECT TO_CHAR(1890.55,'$0G000D00')
FROM DUAL;
B.SELECT TO_CHAR(1890.55,'$9,999V99')
FROM DUAL;
C.SELECT TO_CHAR(1890.55,'$99,999D99')
FROM DUAL;
D.SELECT TO_CHAR(1890.55,'$99G999D00')
FROM DUAL;
E.SELECT TO_CHAR(1890.55,'$99G999D99')
FROM DUAL;
Answer: ADE
40. View the Exhibit and examine the structure of the CUSTOMERS table.
Which two tasks would require subqueries or joins to be executed in a single
statement? (Choose two.)
A. listing of customers who do not have a credit limit and were born before 1980
B. finding the number of customers, in each city, whose marital status is 'married'
C. finding the average credit limit of male customers residing in 'Tokyo' or
'Sydney'
D. listing of those customers whose credit limit is the same as the credit limit of
customers residing in the city 'Tokyo'
E. finding the number of customers, in each city, whose credit limit is more than
the average credit limit of all the customers
Answer: DE
Answer: D
43. View the Exhibit and examine the structure of the PRODUCTS table.
All products have a list price.
You issue the following command to display the total price of each product after a
discount of 25% and a tax of 15% are applied on it. Freight charges of $100 have to
be applied to all the products.
SQL>SELECT prod_name, prod_list_price-(prod_list_price*(25/100))
+(prod_list_price -(prod_list_price*(25/100))*(15/100))+100
AS "TOTAL PRICE"
FROM products;
44. You can add a row using SQL in a database with which of the following?
A.ADD
B.CREATE
C.INSERT
D.MAKE
Answer: C
45. The command to remove rows from a table 'CUSTOMER' is:
A.REMOVE FROM CUSTOMER ...
B.DROP FROM CUSTOMER ...
C.DELETE FROM CUSTOMER WHERE ...
D.UPDATE FROM CUSTOMER ...
Answer: C
Answer: b
Answer: A
Answer: B
Answer: B
52. SQL data definition commands make up a(n) ________ .
A.DDL
B.DML
C.HTML
D.XML
Answer: A
Answer: C
55. Which of the following is the correct order of keywords for SQL SELECT
statements?
A.SELECT, FROM, WHERE
B.FROM, WHERE, SELECT
C.WHERE, FROM,SELECT
D.SELECT,WHERE,FROM
Answer: A
58. Which of the following are the five built-in functions provided by SQL?
A.COUNT, SUM, AVG, MAX, MIN
B.SUM, AVG, MIN, MAX, MULT
C.SUM, AVG, MULT, DIV, MIN
D.SUM, AVG, MIN, MAX, NAME
Answer: A
59. In an SQL SELECT statement querying a single table, according to the SQL-92
standard the asterisk (*) means that:
A. all columns of the table are to be returned.
B. all records meeting the full criteria are to be returned.
C. all records with even partial criteria met are to be returned.
D. None of the above is correct.
Answer: A
60. The HAVING clause does which of the following?
A. Acts like a WHERE clause but is used for groups rather than rows.
B. Acts like a WHERE clause but is used for rows rather than columns.
C. Acts like a WHERE clause but is used for columns rather than groups.
D. Acts EXACTLY like a WHERE clause.
Answer: A
62.To remove duplicate rows from the results of an SQL SELECT statement, the
________ qualifier specified must be included.
A.ONLY
B.UNIQUE
C.DISTINCT
D.SINGLE
Answer: C
63. The benefits of a standard relational language include which of the following?
A. Reduced training costs
B. Increased dependence on a single vendor
C. Applications are not needed.
D. All of the above.
Answer: c
65. Which clause specifies the tables or views from which to retrieve the data?
A. SELECT
B. FROM
C. WHERE
D. GROUP BY
E. HAVING
Answer: B
67. When an aggregate function is used, which clause divides the data into distinct
groups?
A. SELECT
B. FROM
C. WHERE
D. GROUP BY
E. HAVING
Answer: D
73. What keyword is used to provide a name for an expression in a SELECT clause?
A. DISTINCT
B. AS
C. HAVING
D. IS
Answer: B
75. What data type is used to store the quantity of time between two dates or
times?
A. DATETIME
B. INTERVAL
C. EXACT NUMERIC
D. APPROXIMATE NUMERIC
Answer: B
76. Which predicate tests whether the value of a given value expression matches an
item in a given list of values?
A. Comparison
B. BETWEEN
C. IN
D. LIKE
E. IS NULL
Answer: C
77. Which predicate enables you to test whether a character string value expression
matches a specified character string pattern?
A. Comparison
B. BETWEEN
C. IN
D. LIKE
E. IS NULL
Answer: D
78. Which predicate uses one of six operators to compare one value expression to
another value expression?
A. Comparison B. BETWEEN C. IN
D. LIKE E. IS NULL
Answer: A
79. Which predicate lets you test whether the value of a given value expression
falls within a specified range of values?
A. Comparison
B. BETWEEN
C. IN
D. LIKE
E. IS NULL
Answer: B
80. Which operator is used to include rows in the result set that did not meet the
condition of the predicate?
A. IS
B. ANY
C. NOT
D. ALL
Answer: C
81. Which operator do you use when all the conditions you combine must be met in
order for a row to be included in a result set?
A. OR
B. AND
C. NOT
D. ANY
E. ALL
Answer: B
82. Which operator do you use when either of the conditions you combine can be met
in order for a row to be included in a result set?
A. OR
B. AND
C. NOT
D. ANY
E. ALL
Answer: A
83. IDENTIFY THE THREE (3) MAIN RELATIONSHIP TYPES THAT EXIST BETWEEN ANY TWO
TABLES? CHOOSE (3)
A. ONE TO ONE
B. ONE TO MANY
C. MANY TO MANY
D. ONE TO OTHER
E. MANY TO OTHERS
ANSWER: ABC
84. IN THIS RELATIONHIP, FOR EACH ROW IN ONE TABLE, THERE EXISTS AT MOST ONE
RELATED ROW IN THE OTHER TABLE..
A. MANY TO OTHERS
B. ONE TO OTHER
C. MANY TO MANY
D. ONE TO MANY
E. ONE TO ONE
ANSWER: E
85. A SET OF RULES THAT HELP IMPROVE DATABASE DESIGN AND ALSO ENSURE AN OPTIMUM AND
EFFICIENT STRUCTURE FOR ANY DATABASE IS KNOWN AS….
A. ENTITY CLUSTER
B. REDUNDANCY
C. ENTITY SUPERTYPE
D. NORMALIZATION
E. CONSTRAINT
ANSWER: D
86. WHAT ARE THE TWO FORMS OF AUTHENTICATION IN SQL SERVER?
A. WINDOWS AUTHENTICATION AND SOFTWARE AUTHENTICATION
B. WINDOWS AUTHENTICATION AND MIXED MODE AUTHENTICATION
C. SQL AUTHENTICATION AND WINDOWS AUTHENTICATION
D. APPLICATION AUTHENTICATION AND SOFTWARE AUTHENTICATION
E. SQL AUTHENTICATION AND APPLICATION AUTHENTICATION
ANSWER: B
87. IDENTIFY THREE FILES SQL SERVER USES TO STORE ITS DATA
A. PRIMARY FILE, CONTROL FILE, REDO FILE
B. PRIMARY FILE, SECONDARY FILE, LOG FILE
C. SYSTEM FILE, APPLICATION FILE, LOG FILE
D. TRANSACTION LOG FILE, PRIMARY FILE, SYSTEM FILE
E. SECONDARY FILE, SYSTEM FILE, APPLICATION FILE
ANSWER: B
88. WHICH OF THESE STATEMENTS IS RESPONSIBLE FOR SEPARATING SECTIONS OF CODE?
A. INSERT
B. UPDATE
C. CREATE
D. DELETE
E. GO
F. ALTER
ANSWER: E
89. IN SQL SERVER 2008, WHICH MODIFIER IS USED TO AUTO – GENERATE UNIQUE NUMBERS
FOR A COLUMN?
A. SEQUENCE
B. AUTONUMBER
C. SYNONYM
D. INDEX
E. IDENTITY
ANSWER: E
90.WHICH OF THESE DETERMINE THE WAY A COLUMN BEHAVES?
A. INDEX
B. CONSTRAINT
C. NORMALIZATION
D. CLUSTER
E. CASCADE
ANSWER: B
91. IN AN SQL SERVER DATAFILE, WHAT IS THE SMALLEST UNIT OF STORAGE?
A. AN EXTENT
B. A PAGE
C. A WORKSHEET
D. A PRIMARY FILE
E. A LOG FILE
ANSWER: B
92.A PLACE IN THE MEMORY THAT IS DECLARED BEFOREHAND AND GIVEN A NAME IS KNOWN AS:
A. AN ENTITY
B. AN ATTRIBUTE
C. A VARIABLE
D. A RECORD
E. AN INSTANCE
ANSWER: C
93. You need to ensure that tables are not dropped from your database. What should
you do?
A. Create a DDL trigger that contains COMMIT.
B. Create a DML trigger that contains COMMIT.
C. Create a DDL trigger that contains ROLLBACK.
D. Create a DML trigger that contains ROLLBACK.
Answer: C
Answer: B
Answer: B
96. Study the T-SQL code below and answer the question that follows :
SELECT DrugID, DrugName, Quantity
FROM DrugDetails.DrugInStock
WHERE DrugName LIKE '%pharma%';
What is the % in the select statement?
A. An operator
B. An operand
C. A predicate
D. A wildcard
Answer: D
97. Study the T-SQL code below and answer the question that follows :
SELECT DrugID, DrugName, Quantity
FROM DrugDetails.DrugInStock
WHERE DrugName LIKE '%pharma%';
The WHERE clause of the select statement restricts rows to the condition presented
within.
A. True
B. False
Answer: A
Answer: A
Answer: A
100. A column named ACCOUNTID has identity of seed value being 5 and an increment
value being 1000.
What would be the ID of the 1st row in the column?
A. 5
B. 10
C. 1000
D. 1005
Answer: A
101. A column named ACCOUNTID has identity of seed value being 5 and an increment
value being 1000.
What would be the ID of the 10th row in the column?
A. 8005
B. 5005
C. 9005
D. 10005
Answer: C
102. What would happen when the Transact-SQL code below is executed on a SQL Server
instance?
DELETE from dbo.accounts
A. The first row of the table would be deleted
B. The table would be deleted from its database
C. The last row of the table would be deleted
D. All rows of the table would be deleted
Answer: D
103. Study the Transact-SQL code below and answer the question that follows
SELECT city + ' ' + street + ' ' + state + ' ' + country
FROM dbo.accountdetails
WHERE accountholder LIKE "%tina";
What is the function of the + in the select statement?
A. Addition
B. Concatenation
C. Combinding
D. Compressing
Answer: B
104. Study the Transact-SQL code below and answer the question that follows
SELECT city + ' ' + street + ' ' + state + ' ' + country Address
FROM dbo.accountdetails
WHERE accountholder LIKE "%tina";
How many columns would be retrieved after executing the code?
A. 2
B. 4
C. 1
D. 5
Answer: C
105. Study the Transact-SQL code below and answer the question that follows
SELECT city + ' ' + street + ' ' + state + ' ' + country AS Address
FROM dbo.accountdetails
WHERE accountholder LIKE "%tina";
The name of the column that would be produced after executing the code is called a
column alias.
A. True
B. False
Answer: A
Answer: C
Answer: B
Answer: B
Answer: D
Answer: E
111. You can add a row using SQL in a database with which of the following?
A.ADD
B.INSERT
C.CREATE
D.MAKE
Answer: B
Answer: C
114.Which of the following SQL clauses is used to select data from 2 or more
tables?
A.WHERE
B.HAVING
C.JOIN
D.None of the above
Answer: C
116.A database can be said to be a container for objects that not only store data,
but also enables data storage and retrieval to operate in a secure and safe manner.
A.True
B.False
C.None of the above
Answer: A
119.What is ANSI?
A.American National Studios Institute
B.American National Standards Institute
C.American National Servers Institute
D.None of the above
Answer: B
120.What is SSMS?
A.SQL Server Managerial Studio
B.SQL Server Management Standard
C.SQL Server Management Studio
D.None of the above
Answer: C
121.When SQL Server is installed more than once on a computer, each installation is
called an instance.
A.True
B.False
C.None of the above
Answer: A
123.Which system database contains the metadata about your database, logins, and
configuration information about the instance?
A.Tempdb
B.Master
C.Model
D.Msdb
Answer: B
129. SQL Server 2005 NOT includes the following system database ………….
A) tempdb Database
B) Master Database
C) Model Database
D) sqldb Database
Answer: D
130. SQL Server stores index information in the ………………… system table.
A) sysindexes
B) systemindexes
C) sysind
D) sysindexes
Answer: D
131. ………………… is a read-only database that contains system objects that are included
with SQL Server 2005.
A) Resource Database
B) Master Database
C) Model Database
D) msdb Database
Answer: A
134. The query used to remove all references for the pubs and newspubs databases
from the system tables is ……………………..
A) DROP DATABASE pubs, newpubs;
B) DELETE DATABASE pubs, newpubs;
C) REMOVE DATABASE pubs, newpubs;
D) DROP DATABASE pubs and newpubs;
Answer: A
135. …………………. clause specifies the groups into which output rows are to be placed
and, if aggregate functions are included in the SELECT clause.
A) ORDER BY
B) GROUP
C) GROUP BY
D) GROUP IN
Answer: C
136. ……………… are predefined and maintained SQL Server where users cannot assign or
directly change the values.
A) Local Variables
B) Global Variables
C) Assigned Variables
D) Direct Variables
Answer: B
137. Microsoft SQL Server NOT uses which of the following operator category?
A) Bitwise Operator
B) Unary Operator
C) Logical Operator
D) Real Operator
Answer: D
138. Which of the following query is correct for using comparison operators in SQL?
A) SELECT sname, coursename FROM studentinfo WHERE age>50 and <80;
B) SELECT sname, coursename FROM studentinfo WHERE age>50 and age <80;
C) SELECT sname, coursename FROM studentinfo WHERE age>50 and WHERE age<80;
D) None of the above
Answer: B
139.How to select all data from studentinfo table starting the name from letter
‘r’?
A) SELECT * FROM studentinfo WHERE sname LIKE ‘r%';
B) SELECT * FROM studentinfo WHERE sname LIKE ‘%r%';
C) SELECT * FROM studentinfo WHERE sname LIKE ‘%r';
D) SELECT * FROM studentinfo WHERE sname LIKE ‘_r%';
Answer: A
140. Which of the following SQL query is correct for selecting the name of staffs
from ‘tblstaff’ table where salary is 15,000 or 25,000?
A) SELECT sname from tblstaff WHERE salary IN (15000, 25000);
B) SELECT sname from tblstaff WHERE salary BETWEEN 15000 AND 25000;
C) Both A and B
D) None of the above
Answer: A
141. The SELECT statement, that retrieves all the columns from empinfo table name
starting with d to p is ……………………..
A) SELECT ALL FROM empinfo WHERE ename like ‘[d-p]%';
B) SELECT * FROM empinfo WHERE ename is ‘[d-p]%';
C) SELECT * FROM empinfo WHERE ename like ‘[p-d]%';
D) SELECT * FROM empinfo WHERE ename like ‘[d-p]%';
Answer: D
142. Select a query that retrieves all of the unique countries from the student
table?
A) SELECT DISTINCT coursename FROM studentinfo;
B) SELECT UNIQUE coursename FROM studentinfo;
C) SELECT DISTINCT coursename FROM TABLE studentinfo;
D) SELECT INDIVIDUAL coursename FROM studentinfo;
Answer: A
143. Which query is used for sorting data that retrieves the all the fields from
empinfo table and listed them in the ascending order?
A) SELECT * FROM empinfo ORDER BY age;
B) SELECT * FROM empinfo ORDER age;
C) SELECT * FROM empinfo ORDER BY COLUMN age;
D) SELECT * FROM empinfo SORT BY age;
Answer: A
144. Select the right statement to insert values to the stdinfo table.
A) INSERT VALUES (“15″, “Hari Thapa”, 45, 5000) INTO stdinfo;
B) INSERT VALUES INTO stdinfo (“15″, “Hari Thapa”, 45, 5000);
C) INSERT stdinfo VALUES (“15″, “Hari Thapa”, 45, 5000);
D) INSERT INTO stdinfo VALUES (“15″, “Hari Thapa”, 45, 5000);
Answer: D
145. How to Delete records from studentinfo table with name of student ‘Hari
Prasad’?
A) DELETE FROM TABLE studentinfo WHERE sname=’Hari Prasad';
B) DELETE FROM studentinfo WHERE sname=’Hari Prasad';
C) DELETE FROM studentinfo WHERE COLUMN sname=’Hari Prasad';
D) DELETE FROM studentinfo WHERE sname LIKE ‘Hari Prasad';
Answer: B
146. Constraint checking can be disabled in existing …………. and ………….. constraints
so that any data you modify or add to the table is not checked against the
constraint.
A) CHECK, FOREIGN KEY
B) DELETE, FOREIGN KEY
C) CHECK, PRIMARY KEY
D) PRIMARY KEY, FOREIGN KEY
Answer: A
147. ………………… joins two or more tables based on a specified column value not
equaling a specified column value in another table.
A) OUTER JOIN
B) NATURAL JOIN
C) NON-EQUIJOIN
D) EQUIJOIN
Answer: C
148. …………………… is a procedural extension of Oracle – SQL that offers language
constructs similar to those in imperative programming languages.
A) SQL
B) PL/SQL
C) Advanced SQL
D) PQL
Answer: B
149. ……………….. combines the data manipulating power of SQL with the data processing
power of Procedural languages.
A) PL/SQL
B) SQL
C) Advanced SQL
D) PQL
Answer: A
150. ………………. has made PL/SQL code run faster without requiring any additional work
on the part of the programmer.
A) SQL Server
B) My SQL
C) Oracle
D) SQL Lite
Answer: C
165. If two groups are not linked in the data model editor, what is the hierarchy
between them?
A) There is no hierarchy between unlinked groups.
B) The group that is right ranks higher than the group that is to right or below
it.
C) The group that is above or leftmost ranks higher than the group that is to right
or below it.
D) The group that is left ranks higher than the group that is to the right.
Answer: C
166. Which of the following types of triggers can be fired on DDL operations?
A) Instead of Trigger
B) DML Trigger
C) System Trigger
D) DDL Trigger
Answer: C
169. A __________ is the smallest unit of information that can be read from or
written to the disk.
a) Track
b) Spindle
c) Sector
d) Platter
Answer: C
170. The disk platters mounted on a spindle and the heads mounted on a disk arm are
together known as ___________.
a) Read-disk assemblies
b) Head–disk assemblies
c) Head-write assemblies
d) Read-read assemblies
Answer: B
171. The disk controller uses ________ at each sector to ensure that the data is
not corrupted on data retrieval.
a) Checksum
b) Unit drive
c) Read disk
d) Readsum
Answer: A
172. _________ is the time from when a read or write request is issued to when data
transfer begins.
a) Access time
b) Average seek time
c) Seek time
d) Rotational latency time
Answer: A
173. The time for repositioning the arm is called the ________, and it increases
with the distance that the arm must move.
a) Access time
b) Average seek time
c) Seek time
d) Rotational latency time
Answer: C
175. Once the head has reached the desired track, the time spent waiting for the
sector to be accessed to appear under the head is called the _______________.
a) Access time
b) Average seek time
c) Seek time
d) Rotational latency time
Answer: D
176. In Flash memory, the erase operation can be performed on a number of pages,
called an _______, at once, and takes about 1 to 2 milliseconds.
a) Delete block
b) Erase block
c) Flash block
d) Read block
Answer: B
177. Hybrid disk drives are hard-disk systems that combine magnetic storage with a
smaller amount of flash memory, which is used as a cache for frequently accessed
data.
a) Hybrid drivers
b) Disk drivers
c) Hybrid disk drivers
d) All of the mentioned
Answer: B
178..
Name
Annie
Bob
Callie
Derek
Which of these query will display the table given above ?
a) Select employee from name
b) Select name
c) Select name from employee
d) Select employee
Answer: C
182. The ________ clause is used to list the attributes desired in the result of a
query.
a) Where
b) Select
c) From
d) Distinct
Answer: B
196. You attempt to query the database with this command: (25)
select nvl (100 / quantity, none)
from inventory;
Why does this statement cause an error when QUANTITY values are null?
a. The expression attempts to divide by a null value.
b. The data types in the conversion function are incompatible.
c. The character string none should be enclosed in single quotes (‘ ‘).
d. A null value used in an expression cannot be converted to an actual value
Answer: A
Answer: A
199. Which of the following is another name for weak entity?
a) Child
b) Owner
c) Dominant
d) All of the mentioned
Answer: A
200. Breadth First Search is used in
a) Binary trees
b) Stacks
c) Graphs
d) Both a and c above
Answer: C
201. The____condition allows a general predicate over the relations being joined.
a) On
b) Using
c) Set
d) Where
Answer: A
202. Which of the join operations do not preserve non matched tuples.
a) Left outer join
b) Right outer join
c) Inner join
d) Natural join
Answer: C
203. Select *
from student join takes using (ID);
The above query is equivalent to
a) Select *
from student inner join takes using (ID);
b) Select *
from student outer join takes using (ID);
c) Select *
from student left outer join takes using (ID);
d) Both a and b
Answer: A
204. What type of join is needed when you wish to include rows that do not have
matching values?
a) Equi-join
b) Natural join
c) Outer join
d) All of the mentioned
Answer: C
205. How many tables may be included with a join?
a) One
b) Two
c) Three
d) All of the mentioned
Answer: D
206. Which are the join types in join condition:
a) Cross join
b) Natural join
c) Join with USING clause
d) All of the mentioned
Answer: D
207. How many join types in join condition:
a) 2
b) 3
c) 4
d) 5
Answer: D
208. Which join refers to join records from the right table that have no matching
key in the left table are include in the result set:
a) Left outer join
b) Right outer join
c) Full outer join
d) Half outer join
Answer: B
209. The operation which is not considered a basic operation of relational algebra
is
a) Join
b) Selection
c) Union
d) Cross product
Answer: A
210. In SQL the statement select * from R, S is equivalent to
a) Select * from R natural join S
b) Select * from R cross join S
c) Select * from R union join S
d) Select * from R inner join S
Answer: B
Answer: A
240. Which of the following is used to store movie and image files ?
a) Clob
b) Blob
c) Binary
d) Image
Answer: B
242. Values of one type can be converted to another domain using which of the
following ?
a) Cast
b) Drop type
c) Alter type
d) Convert
Answer: A
245. In contemporary databases the top level of the hierarchy consists of ______,
each of which can contain _____.
a) Catalogs, schemas
b) Schemas, catalogs
c) Environment, schemas
d) Schemas, Environment
Answer: A
246. Which of the following statements creates a new table temp instructor that has
the same schema as instructor.
a) create table temp_instructor;
b) Create table temp_instructor like instructor;
c) Create Table as temp_instructor;
d) Create table like temp_instructor;
Answer: B
247. To include integrity constraint in a existing relation use :
a) Create table
b) Modify table
c) Alter table
d) Drop table
Answer: C
Answer: D
258. Which of the following has each related entity set has its own schema and
there is an additional schema for the relationship set.
a) A many-to-many relationship set
b) A multivalued attribute of an entity set
c) A one-to-many relationship set
d) Both a and b
Answer: A
259. In which of the following , a separate schema is created consisting of that
attribute and the primary key of the entity set.
a) A many-to-many relationship set
b) A multivalued attribute of an entity set
c) A one-to-many relationship set
d) Both a and b
Answer: B
260. Suppose the user finds the usage of room number and phone number in a
relational schema there is confusion.This is reduced by
a) Unique-role assumption
b) Unique-key assignment
c) Role intergral assignment
d) None of the mentioned
Answer: A
261. What is the best way to represent the attributes in a large database?
a) Relational-and
b) Concatenation
c) Dot representation
d) All of the above
Answer: B
262. Designers use which of the following to tune performance of systems to support
time-critical operations?
a) Denormalization
b) Redundant optimization
c) Optimization
d) Realization
Answer: A
263. In the schema (dept name, size) we have relations total inst 2007, total inst
2008 . Which dependency have lead to this relation ?
a) Dept name, year->size
b) Year->size
c) Dept name->size
d) Size->year
Answer: A
264. Relation dept year(dept name, total inst 2007, total inst 2008, total inst
2009) .Here the only functional dependencies are from dept name to the other
attributes .This relation is in
a) Fourth NF
b) BCNF
c) Third NF
d) Second NF
Answer: B
265. Thus a _______ of course data gives the values of all attributes, such as
title and department, of all courses at a particular point in time.
a) Instance
b) Snapshot
c) Both a and b
d) All of the mentioned
Answer: B
266. Representations such as the in the dept year relation, with one column for
each value of an attribute, are called _______; they are widely used in
spreadsheets and reports and in data analysis tools.
a) Cross-tabs
b) Snapshot
c) Both a and b
d) All of the mentioned
Answer: A
267. Which one of the following is used to define the structure of the
relation ,deleting relations and relating schemas ?
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema
Answer: B
268. Which one of the following provides the ability to query information from the
database and to insert tuples into, delete tuples from, and modify tuples in the
database ?
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema
Answer: A
Answer: A
271. The basic data type char(n) is a _____ length character string and varchar(n)
is _____ length character.
a) Fixed, equal
b) Equal, variable
c) Fixed, variable
d) Variable, equal
Answer: C
272. An attribute A of datatype varchar(20) has the value “Avi” . The attribute B
of datatype char(20) has value ”Reed” .Here attribute A has ____ spaces and
attribute B has ____ spaces .
a) 3, 20
b) 20, 4
c) 20 , 20
d) 3, 4
Answer: A
273. To remove a relation from an SQL database, we use the ______ command.
a) Delete
b) Purge
c) Remove
d) Drop table
Answer: D
Answer: B
Answer: A
277. Having clause is processed after the GROUP BY clause and any aggregate
functions.
A) True
B) False
Answer: A
278. In the context of MS SQL SERVER, with the exception of ............ column(s),
any column can participate in the GROUP BY clause.
A) bit
B) text
C) ntext
D) image
E) All of above
Answer: E
279. The sequence of the columns in a GROUP BY clause has no effect in the ordering
of the output.
A) True
B) False
Answer: B
280. You want all dates when any employee was hired. Multiple employees were hired
on the same date and you want to see the date only once.
Query - 1
Select distinct hiredate
From hr.employee
Order by hiredate;
Query - 2
Select hiredate
From hr.employees
Group by hiredate
Order by hiredate;
Which of the above query is valid?
A) Query - 1
B) Query - 2
C) Both
Answer: C
281. GROUP BY ALL generates all possible groups - even those that do not meet the
query's search criteria.
A) True
B) False
Answer: A
282. All aggregate functions ignore NULLs except for ............
A) Distinct
B) Count (*)
C) Average()
D) None of above
Answer: B
283. Using GROUP BY ............ has the effect of removing duplicates from the
data.
A) with aggregates
B) with order by
C) without order by
D) without aggregates
Answer: D
284. Below query is run in SQL Server 2012, is this query valid or invalid:
Select count(*) as X
from Table_Name
Group by ()
A) Valid
B) Invalid
Answer: A
285. For the purposes of ............, null values are considered equal to other
nulls and are grouped together into a single result row.
A) Having
B) Group By
C) Both of above
D) None of above
Answer: B
286. If you SELECT attributes and use an aggregate function, you must GROUP BY the
non-aggregate attributes.
A) True
B) False
Answer: A
A) The above example allows Jim to add other permissions to the user-defined server
role named Production.
B) The above example allows Jim to add other roles to the user-defined server role
named Production.
C) The above example allows Jim to add other logins to the user-defined server role
named Production.
D) None of above.
Answer: C
288. The CONTROL SERVER and ALTER ANY SERVER ROLE permissions are sufficient to
execute ALTER SERVER ROLE for a fixed server role.
A) True
B) False
Answer: B
289. The following statement returns all Database Engine permissions.
A) True
B) False
Answer: A
291. DENY revokes a permission so that it cannot be inherited. DENY takes
precedence over all permissions, except DENY does not apply to .......
A) elected
B) restricted
C) admin
D) all
Answer: D
294. Members of the sysadmin fixed server role and object owners cannot be denied
permissions.
A) True
B) False
Answer: A
295. The permissions granted to logins and user-defined fixed server roles can be
examined by using the ....... view.
A) sys.credentials
B) sys.server_role_members
C) sys.server_permissions
D) None of above
Answer: C
296. Users with the ........ permission can create new user-defined database roles
to represent groups of users with common permissions.
A) CREATE CERTIFICATE
B) CREATE CONTRACT
C) CREATE LOGIN
D) CREATE ROLE
Answer: D
297. In SQL Server 2012, the merge join does not need any equijoin predicate.
A) True
B) False
Answer: B
298. A merge join can be . . . . .
A) many-to-one
B) many-to-many
C) one-to-one
D) one-to-many
Answer: BD
299. Inputs to the merge join may or may not be sorted on the join keys.
A) True
B) False
Answer: B
300. With a merge join each table is read at most once, and the total cost is
proportional to the . . . . . of the number of rows in the inputs. Thus, merge join
is often a better choice for larger inputs.
A) proportion
B) product
C) sum
D) none of above
Answer: C
301. Merge joins support all outer and semi-join variations.
A) True
B) False
Answer: A
302. SQL Server can get sorted inputs for a merge join in two ways: It can
explicitly sort the inputs using a sort operator or it can read the rows from an
index. In general, a plan using an index to achieve sort order is . . . . . . than
a plan using an explicit sort.
A) cheaper
B) costlier
C) sometimes cheaper and sometimes costlier
D) none of above
Answer: A
303. A merge join necessarily need to scan every row from both inputs. As soon as
it reaches the end of either input, the merge join stops scanning.
A) True
B) False
Answer: B
304. Merge join supports multiple equijoin predicates as long as the inputs are
sorted on . . . . . . the join keys.
A) some of
B) one of
C) all
D) none of above
Answer: C
305. Merge join supports a special case where in some cases, the optimiser
generates a merge join for a full outer join, even without an equijoin predicate.
A) True
B) False
Answer: A
306. Merge join itself is generally slow, but it can be an expensive choice if sort
operations are required.
A) True
B) False
Answer: B
307. Hash join is designed to handle large . . . . inputs.
A) sorted
B) unsorted
Answer: B
308. Hash joins are used for many types of set-matching operations such
as . . . . .
A) intersection
B) inner join
C) left, right, and full outer join
D) both A & B
E) all of above
Answer: E
309. When an in-memory hash join is not possible, the Hash Warning is fired. The
idea behind this event is that grace hash join and recursive hash joins are . . . .
efficient and that the DBA should be aware of this.
A) more
B) equally
C) less
D) none of above
Answer: C
310. There are 3 different types of hash joins . . . . . .
A) True
B) False
Answer: A
312. There are three SQLTrace events that fire in response to hash spills, sort
spills and exchange spills. They are ......
A) Spill bailout
B) Join bailout
C) Spill Warning bailout
D) Hash bailout
Answer: D
314. Hash join performs its operations in 2 phases . . . . . .
A) True
B) False
Answer: A
316. A . . . . . . is a join method that used elements of both a simple in-memory
hash and grace hash.
A) combined join
B) hybrid join
C) team join
Answer: B
317. A columnstore index is a technology for storing, retrieving and managing data
by using a columnar data format, called a . . . . . . .
A) column segment
B) deltastore
C) columnstore
D) columnar
Answer: C
318. As an example, if a table has 50 columns and the query only uses 5 of those
columns, the columnstore index only fetches the . . . . . columns from disk. It
skips reading in the other . . . . . . columns.
A) 5, 45
B) 45, 5
C) 10, 40
D) 40, 10
Answer: A
319. A nonclustered columnstore index and a clustered columnstore index function
the same. The difference is a nonclustered index is a secondary index created on
a . . . . . . . table, whereas a clustered columnstore index is the primary storage
for the . . . . . . . table.
A) columnstore, entire
B) rowstore, entire
C) rowstore, columnstore
D) columnstore, rowstore
Answer: B
320. Columnstore indexes read compressed data from disk, which means fewer bytes of
data need to be read into memory.
A) True
B) False
Answer: A
321. Columnstore indexes give high performance gains . . . . . . . . .
A) for analytic queries that scan large amounts of data, especially on large tables
B) for queries on a small range of values
C) in case of fact tables, since they tend to require full table scans rather than
table seeks
D) Both A & C
Answer: D
322. Clustered columnstore indexes collect up to 1,048,576 rows in deltastore
before compressing them into the compressed rowgroup. Once the rowgroup contains
1,048,576 rows, the delta rowgroup is marked closed . . . .
A) but it is still available for queries and update/delete operations but the newly
inserted rows go into an existing or newly created deltastore rowgroup.
B) and is not available for queries and update/delete operations. The newly
inserted rows go into an existing or newly created deltastore rowgroup.
C) and is not available for queries and update/delete operations. The new rows
cannot be inserted.
D) but it is still available for queries and update/delete operations but the new
rows cannot be inserted.
Answer: A
323. The memory required for creating a columnstore index depends on
the . . . . . . .
A) number of columns
B) number of string columns
C) DOP
D) Both A & B
E) All of above
Answer: A
324. If your table has fewer than one million rows, SQL Server will use only one
thread to create the columnstore index.
A) True
B) False
Answer: A
325. By design, a columnstore table . . . . . . . a primary key constraint.
A) allows
B) does not allow
Answer: B
326. Because data in a columnstore index is grouped by columns, rather than by
rows, data can be compressed as efficiently as with rowstore indexes.
A) True
B) False
Answer: B
A) True
B) False
Answer: A
328.SQL Server can automatically provide values for ......
A) nullable columns
B) IDENTITY columns
C) columns with the timestamp data type
D) columns with a default value
E) All of above
F) None of above
Answer: E
329.Which of the following insert statements are correct:
A)
INSERT INTO Persons ('xxx1','yyy1');
B)
INSERT INTO [dbo].[Persons]
([LastName],
[FirstName]
)
VALUES ('xxx',
'yyy'
);
C)
INSERT INTO Persons VALUES ('xxx1','yyy1');
D)
INSERT INTO Persons VALUE ('xxx1','yyy1');
Answer: BC
330.In SQL Server, you use the INSERT statement to add one new row and not multiple
new rows to an existing table.
A) True
B) False
Answer: B
331. You can insert data into a table from the results of the EXECUTE statement.
A) True
B) False
Answer: A
332. You can use the INSERT statement to insert data into a .......
A) particular column
B) all columns
C) IDENTITY columns
D) All of above
E) None of above
Answer: D
333.SQL Server supports several methods for inserting data into tables
including ........
A) SELECT INTO
B) BULK SELECT INSERT
C) INSERT SELECT
D) INSERT SELECT FROM OPENROWSET(BULK …)
Answer: ACD
334. Which of the below statement/statements is correct if we need to insert
multiple values with one insert query:
1. INSERT INTO Persons VALUES ('xxx1','yyy1'), ('xxx2','yyy2'), ('xxx3','yyy3');
2. INSERT INTO Persons VALUES ('xxx1','yyy1'), VALUES ('xxx2','yyy2'),
Values ('xxx3','yyy3');
A) only 1 is correct
B) only 2 is correct
C) Both are correct
D) None is correct
Answer: A
335. Tick the statements which are true.
It is always a good idea to provide a full-column list for INSERT statement because
if the full-column list is not specified then
A) TYPE
B) NUMBER
C) TOP
D) PERCENT
Answer: C
A) Update
B) Where
C) an ORDER BY
D) DISTINCT
Answer: C
339. If you need to reference/join the same data set multiple times, then CTE is
not the choice.
A) True
B) False
Answer: B
340. You can use a CTE within a CREATE VIEW statement.
A) True
B) False
Answer: A
341. SELECT statements within recursive CTEs cannot contain which of the following:
A) True
B) False
Answer: A
343. CTE is different from view in a way that CTE is not created as ..............
in the database and therefore is only available for this single statement.
A) Table
B) Link
C) Procedure
D) an object
Answer: D
344. CTEs rely on stats of the ................... as CTEs do not have dedicated
stats of their own.
A) system Tables
B) static views
C) underlying objects
D) None of above
Answer: C
345. Tables which are on the remote servers cannot be referenced in the CTE.
A) True
B) False
Answer: B
346. A CTE can reference itself and previously defined CTEs in the same WITH
clause.
A) True
B) False
Answer: A
347. Which logical method can be used in SQL Server 2012 to returns an item from
the specified index in a list of values?
a) SELECT
b) SELECTION
c) CHOOSE
d) None of the above
Answer: C
348. RAND () method can be used for:
a) ASIN
b) ASINE
c) SIN
d) None of the above
Answer: A
350. What will an IIF() method of SQL server 2012 do in a query?
a) Nothing
b) It will return 1 of 2 values supplied as parameters and depends on whether the
Boolean parameter evaluates to true or false.
c) It works inside the IF statement
d) None of the above.
Answer: B
351. What is the significance of LEFT method in SQL server 2012?
a) FILL
b) STUFF
c) MERGE
d) None of the above
Answer: B
353. What is the purpose of CAST function in SQL server?
a) No there is no method
b) Try_Cast
c) CAST
d) None of the above
Answer: B
356. What is the purpose of MIN function in SQL Server?
a) COUNTER
b) COUNT
c) DETECT
d) None of the above
Answer: B
358. A nonclustered index greatly affect the ordering and storing of the data.
A) True
B) False
Answer: B
359. Full-text indexes are created using the
A) Create Index
B) Create Fulltext Index
C) Special System Stored Procedures
D) Both b & c
Answer: D
360. A ................ index is one which satisfies all requested columns in a
query without performing a further lookup into the clustered index.
A) Clustered
B) Non-Clustered
C) Covering
D) B-tree
Answer: C
361. Each database can have only one clustered index.
A) True
B) False
Answer: A
362. While creating an index on a column(s) in MS SQL Server you can specify that
the index on each column be either ascending or descending and this affects the
performance.
A) True
B) False
Answer: A
362. In a ..................., the first row added to the indexis the first record
in the table, the second row is the second record in the table and so on.
A) Clustered
B) Non-Clustered
C) Heap
D) CharIndex
Answer: C
364. In ........... index, instead of storing all of the columns for a record
together, each column is stored separately with all of the other rows in an index.
A) Clustered
B) Column Store
C) Non-Clustered
D) Row Store
Answer: B
365. Without primary key, the creation of spatial index will not succeed.
A) True
B) False
Answer: A
366. If an index is ............................. the metadata and statistics
continue to exist.
A) disabling
B) dropping
C) altering
D) Both a & b
Answer: A
367. Index rebuild and index reorganize is one and the same thing.
A) True
B) False
Answer: B
368. You can instruct SQL Server to use a specific JOIN type by using the . . . . .
A) Query hints
B) Join hints
C) Table hints
D) All of above
Answer: B
369. For Joint type "nested loop" Join hint is . . . . . .
A) Remote join
B) Hash Join
C) Loop Join
D) Merge Join
Answer: C
370. The . . . . . hint dictates that the join operation is performed on the server
hosting the right table.
A) Remote join
B) Hash Join
C) Loop Join
D) Merge Join
Answer: A
371. For simple queries affecting a small result set, the loop join generally
provides better performance than a hash or merge join.
A) True
B) False
Answer: A
372. You cannot specify join hints when you use the ANSI-style join syntax - that
is, when you actually use the keyword JOIN in the query.
A) True
B) False
Answer: B
373. It is possible to specify more than one join type in the query hint and allow
SQL Server to choose the least-expensive one.
A) True
B) False
Answer: A
374. A . . . . hint takes precedence over a . . . . hint if both are specified.
A) query, join
B) join, query
Answer: B
375. The Remote join, that is used when dealing with data from a remote server has
serious affects on execution plans.
A) True
B) False
Answer: B
376. Use a REMOTE join hint only when the . . . . table has fewer rows than the . .
. . table.
A) left, right
B) right, left
Answer: A
377. . . . . . specifies that the join order indicated by the query syntax is
preserved during query optimization.
A) KEEP PLAN
B) MAX_GRANT_PERCENT
C) FORCE ORDER
D) EXPAND VIEWS
Answer: C
A) True
B) False
Answer: B
379. The subquery is known as a ................. subquery because the subquery is
related to the outer SQL statement.
A) Relational
B) Related
C) Correlated
D) Corelational
Answer: C
380. A subquery can itself include one or more subqueries. ..............
subqueries can be nested in a statement.
A) 16
B) 32
C) 64
D) Any number of
Answer: D
381. In case of correlated subquery the outer query is executed once. The subquery
is executed ............. for every row in the outer query.
A) Once
B) Twice
C) Thrice
D) Both A & B
Answer: A
382. The SELECT query of a subquery is always enclosed in parentheses and may only
include an ORDER BY clause only when a TOP clause is also specified.
A) True
B) False
Answer: A
383. Below subquery is valid or invalid:
A) Valid
B) Invalid
Answer: A
384. There cannot be a subquery which is independent of the outer query.
A) True
B) False
Answer: B
385. Below is an example of
SELECT a.EmployeeID
FROM HumanResources.Employee a
WHERE a.ContactID IN
(
SELECT b.ContactID
FROM Person.Contact b
WHERE b.Title = 'Mrs.'
)
GO
A) Correlated Subquery
B) Noncorrelated Subquery
Answer: B
386. If a table appears only in a subquery and not in the outer query, then columns
from that table can be included in the output.
A) True
B) False
Answer: B
387. A subquery can be used anywhere an expression is allowed.
A) True
B) False
Answer: A
A) True
B) False
Answer: A
390. Which command to use in order to delete the data inside the table, and not the
table itself
Answer: B
A) DELETE
B) TRUNCATE
C) Both TRUNCATE & DELETE
D) DROP
Answer: B
391. Transaction rollbacks affect Table variables
A) True
B) False
Answer: B
392. ##table refers to a ............. which is visible to all users.
A) table variables
B) persistent temporary tables
C) local temporary tables
D) global temporary table
Answer: D
393. Delete table and Drop table are not the same though. The ......... will delete
all data from the table whilst the ....... will remove the table from the database.
A) Drop,Delete
B) Delete, Drop
Answer: B
394. Below Query shows:
USE DBName
GO
SELECT *
FROM sys.Tables
GO
A) List of system tables of Database
B) List of temporary tables of Database
C) List of all tables of Database
D) Both A & B
Answer: C
395. sp_tables returns only the views in the database.
A) True
B) False
Answer: B
396. In order to modify system tables you can use:
A) sp_configure
B) sp_modify
C) sp_allow_updates
D) Both A & B
Answer: A
397. ......... and ......... system tables maintain entries containing object
definitions and other tracking information for each object.
A) sysobjects
B) syscomments
C) systrack
D) Both A & B
Answer: D
a) True
b) False
Answer: A
401. Which category Delete query exits?
a) DDL
b) DML
c) TCL
d) BPL
Answer: B
402. Does delete statement maintains lock?
a) True
b) False
Answer: A
403. Delete statements locks whole Table or a single Row at a time?
a) Yes
b) No
Answer: A
a) True
b) False
Answer: A
410. What is not true about truncate?
a) True
b) False
Answer: B
412. Which one is faster to delete a table?
a) Truncate
b) Delete
c) Remove
d) None of the above
Answer: A
413. What are the restrictions while using Truncate?
a) Both
b) Only Row
c) Table
d) None of the above
Answer: C
416. Can Truncate be used in Views?
a) True
b) False
Answer: B
417. What is true about truncate with Foreign key?
a) It will delete the rows from both the tables (child as well as parent)
b) It will not delete even if CASCADE ON DELETE option is given with parent table
c) It will delete even if CASCADE ON DELETE option is given with parent table
d) All are true
Answer: B
418. TRUNCATE can’t be used if you have Replication/ CDC enabled for the table, is
it true?
a) True
b) False
Answer: A
a) From
b) SELECT
c) Order By
d) Where
Answer: C
420. Can we create Clustered Index with Count (*) in a view?
a) True
b) False
Answer: B
421. Refer below query which leads to create a view named vwEmployee.
a) True
b) False
Answer: A
423. IN SQL Server, can we Create Partitioned Views?
a) True
b) False
Answer: A
424. How can you drop more than one View in single command?
a) Yes
b) No
Answer: A
426. Views are also called as:
a) Complex tables
b) Simple tables
c) Virtual tables
d) Actual Tables
Answer: C
427. Are views stored in Databases?
a) Yes
b) No
Answer: A
a) Primary
b) Foreign
c) Alternate
d) Secondary
Answer: D
429. Can a column with Primary Key have Null value?
a) True
b) False
Answer: B
430. How can a SQL developer add a key on a table?
a) True
b) False
Answer: A
432 A Key which is a set of one or more columns that can identify a record uniquely
is called?
a) Natural key
b) Candidate key
c) Not Null key
d) Alternate key
Answer: B
433. What is true about Unique and primary key?
a) Unique can have multiple NULL values but Primary can’t have.
b) Unique can have single NULL value but Primary can’t have even single.
c) Both can have duplicate values
d) None of the above
Answer: B
434. Can a table have more than one foreign key?
a) True
b) False
Answer: A
435. By default, which key creates Clustered index?
a) Foreign Key
b) Unique Key
c) Primary Key
d) None of the above
Answer: C
436. Which key accepts multiple NULL values?
a) Foreign Key
b) Unique Key
c) Primary Key
d) None of the above
Answer: A
437. Can column with Unique key have duplicate values?
a) True
b) False
Answer: B
438.. While using the IN operator, the SQL engine will scan all records fetched
from the inner query.
A) True
B) False
Answer: A
439. Consider the below table.
Table tab_1:
ID Column_2 Name
11 F1 Fardeen
22 G1 Gautam
33 H1 Harish
44 I1 Fardeen
55 E1 Eklavya
NULL NULL NULL
0 0 0
A)
ID Column_2 Name
0 0 0
B)
ID Column_2 Name
NULL NULL NULL
C)
ID Column_2 Name
11 F1 Fardeen
22 G1 Gautam
33 H1 Harish
44 I1 Fardeen
55 E1 Eklavya
NULL NULL NULL
0 0 0
D)None of above
Answer: C
440.. The select list of a subquery introduced by EXISTS almost always consists of
………. There is no reason to list column names as you are just verifying whether rows
that meet the conditions specified in the subquery exist.
A) percent (%)
B) asterisk (*)
C) Comma (,)
D) None of above
Answer: B
441. Only EXISTS can be prefixed with NOT but IN cannot be.
A) True
B) False
Answer: B
442. When EXISTS is used, SQL Server stops as soon as it finds .......... record
that matches the criteria.
A) Middle
B) Last
C) One
D) None of above
Answer: C
443. NOT EXISTS works like EXISTS, except the WHERE clause in which it is used is
satisfied if ........... rows are returned by the subquery.
A) Two
B) Unpinned
C) TOP
D) No
D
444. The keyword EXISTS is not preceded by a ............
A) constant
B) column name
C) other expression
D) All of above
Answer: D
445. Consider the below table.
Table dbo.tab_1
ID Column_2 Name
11 F1 Fardeen
22 G1 Gautam
33 H1 Harish
44 I1 Fardeen
55 E1 Eklavya
SELECT *
FROM Tab_1
WHERE ','+@InList+',' LIKE ',%'+CAST(Id AS varchar)+',%'
A)
ID Column_2 Name
11 F1 Fardeen
33 H1 Harish
44 I1 Fardeen
B)
ID Column_2 Name
11 F1 Fardeen
22 G1 Gautam
33 H1 Harish
44 I1 Fardeen
C)
ID Column_2 Name
11 F1 Fardeen
22 G1 Gautam
33 H1 Harish
44 I1 Fardeen
55 E1 Eklavya
D) None of above
Answer: A
446. Consider the below table.
Table tab_1
ID Column_2 Name
11 F1 Fardeen
22 G1 Gautam
33 H1 Harish
44 I1 Fardeen
55 E1 Eklavya
NULL NULL NULL
A)
ID Column_2 Name
11 F1 Fardeen
22 G1 Gautam
33 H1 Harish
44 I1 Fardeen
55 E1 Eklavya
C)
ID Column_2 Name
NULL NULL NULL
D)
ID Column_2 Name
11 F1 Fardeen
22 G1 Gautam
33 H1 Harish
44 I1 Fardeen
55 E1 Eklavya
NULL NULL NULL
Answer: D
457. Exists uses a ............ to join values from a column to a column within the
subquery.
A) View
B) Join
C) Subquery
D) Clustered Index
Answer: B
a) True
b) False
Answer: B
How is Column wise insertion of data different from simply passing values to a
table?
a) Column wise data leads in populating data on optional basis i.e. whether user
wanted to insert data in a column or not.
b) We can’t pass value to a table without mentioning column names in an insert
statement.
c) Passing values to a table without column names is always safe.
d) None of the above.
Answer: A
450 Update statement is used to insert values in a table and therefore it is a
replacement of insert statement, is it correct?
a) True
b) False
Answer: B
451. Which one is correct syntax for Update Statement?
a) True
b) False
c) It is replacement of update
d) None of the above
Answer: B
456. Can we use ‘where’ clause in an Insert statement?
a) True
b) False
Answer: B
457. Which one is correct syntax for Where clause in SQL server?
a) True
b) False
Answer: B
460. What is the purpose of Order By Clause in SQL server?
a) Descending
b) Ascending
c) Random
d) None of the above
Answer: B
464. Among the below Order By queries, which are correct ones?
a) True
b) False
Answer: A
466. Can ‘IN’ operator be used with Where clause?
a) True
b) False
Answer: A
a) True
b) False
Answer: A
471. Is UNION or UNION ALL operator valid for LONG data type column?
a) True
b) False
Answer: B
472. Can we use UNION operator in SELECT statement which contains TABLE collection
expressions?
a) True
b) False
Answer: B
473. UNION operator requires an extra overhead of removing redundant rows, is it
true?
a) True
b) False
Answer: A
474. What is true about order by with Union operator?
a) True
b) False
Answer: A
476. If we know the records returned by our query are unique then which operator
will be preferred out of UNION or UNION ALL?
a) Union
b) Union ALL
Answer: B
a) Left Join
b) Left Outer Join
c) Right Outer Join
d) Cross Join
Answer: D
478. Are FULL Outer Join and Cross Join Same?
a) False
b) True
Answer: B
479. The JOIN which returns all the records from the right table in conjunction
with the matching records from the left table and if there are no matching values
in the left table, it returns NULL. Which is this JOIN?
a) Right JOIN
b) CROSS JOIN
c) LEFT Join
d) Full OUTER JOIN
Answer: A
480. What are also called Self Joins?
a) OUTER Joins
b) INNER joins
Answer: B
481. What is true about NOT INNER JOIN?
a) Equi Join
b) In Join
c) Out Join
d) All of the above
Answer: A
483. List the types of Inner join?
a) Equi.
b) Natural
c) Cross
d) Outer
Answer: B
485. Which type of Inner Join fetches result with redundant data?
a) Cross
b) Left Outer
c) IN
d) Equi
Answer: D
486. Which join is used for Joining the table to itself?
a) In
b) Natural
c) Cross
d) Self
Answer: D
487. Which join refers to join records from the right table that have no matching
key in the left table are include in the result set:
a) Left outer join
b) Right outer join
c) Full outer join
d) Half outer join
Answer: B