0% found this document useful (0 votes)
8 views10 pages

Tài liệu thi SQL Aptech

The document contains a series of review questions related to data handling using T-SQL, covering topics such as database structure, SQL commands, data types, and functions. Each question provides multiple-choice answers, testing knowledge on various aspects of SQL Server and T-SQL operations. It serves as a study guide for individuals looking to enhance their understanding of T-SQL and its functionalities.

Uploaded by

nqahome3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

Tài liệu thi SQL Aptech

The document contains a series of review questions related to data handling using T-SQL, covering topics such as database structure, SQL commands, data types, and functions. Each question provides multiple-choice answers, testing knowledge on various aspects of SQL Server and T-SQL operations. It serves as a study guide for individuals looking to enhance their understanding of T-SQL and its functionalities.

Uploaded by

nqahome3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

REVIEW QUESTIONS - Data Handling using T-SQL

Question 1: Which of the following is the skeleton structure of the database?

a. Attribute
b. Entity
c. Record
d. Schema

Question 2: What error will you get when number of columns and values do not match in an Insert statement?

a. Executes without any error.


b. The number of values in the VALUES clause must match the number of columns specified in the INSERT
statement.
c. Insert done with NULL values is columns with no values.
d. None of these.

Question 3: Which of the following keys are used in RDBMS?

a. Primary Key
b. Universal Key
c. Candidate Key
d. Alternate Key

Question 4: Merge statement helps in managing ________________.

a. only insertions
b. only deletions
c. only creations
d. all updations

Question 5: Which of the following procedural languages is used to interact with Microsoft SQL server?

a. SQL
b. Transact-SQL
c. MySQL
d. NoSQL
Question 6: Which of the following object cannot be used with comparison operators?

a. Image
b. Int
c. Boolean
d. Bigint

Question 7: Which of the following statements is not a DCL statement?

a. COMMIT
b. GRANT
c. ROLLBACK
d. REVOKE

Question 8: What is the default Server type in SQL server Management studio?

a. Database Service
b. Database Engine
c. Analysis Service
d. Azure Storage

Question 9: Which of the following operator is used to get rows from two tables without duplication?

a. Union
b. Union All
c. Intersect
d. Except

Question 10: Which of the following categories of data types are supported by SQL Server?

a. Exact numeric
b. Date and time
c. Decimal strings
d. Binary strings

Question 11: Which of the following data types cannot be used as expressions in a Comparison operator?

a. text
b. int
c. float
d. varchar
Question 12: Which of the following is NOT true about Insert statement?

a. Insert helps to insert a single row.


b. Insert helps to insert multiple rows.
c. Insert helps to insert from another table or view.
d. Insert helps to insert table from another database.

Question 13: Which of the following commands signals the end of a batch of Transact-SQL statements?

a. END
b. FINISH
c. GO
d. DONE

Question 14: Which of the following statements are true about GOTO statement?

a. It alters the flow of execution to a label.


b. The Transact-SQL statement or statements that follow GOTO are skipped and processing continues at
the label.
c. GOTO statements and labels can be used anywhere within a procedure, batch, or statement block.
d. GOTO statements cannot be nested.

Question 15: Which of the following transaction statements are provided by SQL server?

a. ROLLBACK TRANSACTION
b. COMMIT TRANSACTION
c. START TRANSACTION
d. SAVE TRANSACTION

Question 16: Which of the following is not an element in the SELECT statement?

a. FROM
b. WHERE
c. GROUP BY
d. HAVING BY
Question 17: Consider that three students obtain full marks in a test and their marks is stored in the
Student_Info table. Which of the following option lists the rank assigned by the Rank() function to rank these
three students and the student who gets the next best marks?

a. 1 and 4
b. 1 and 2
c. 4 and 1
d. 3 and 4

Question 18: Which of the following statements are true about specifying “alias” in the SELECT statement?

a. An alias can be specified as an alternate name for a table or a column in a query.


b. Aliases are temporary and do not change the name in the source database.
c. It is a combination of values, operators, and functions that can be used to manipulate data.
d. It provides functions to handle the NULL value.

Question 19: Which of the following functions is used to obtain the first non-null value in a list of values?

a. ISNULL
b. IFNULL
c. COALESCE
d. NOTNULL

Question 20: Which of the following function helps in defining ranks in a group?

a. Rank
b. DenseRank
c. Ntile
d. Order

Question 21: Which of the following filter options in T-SQL is used as a comparison predicate that takes two
expressions as input and verifies whether those two expressions have different values?

a. CONTAINS
b. WHERE
c. FREETEXT
d. IS [NOT] DISTINCT FROM
Question 22: Which of the following logical operators returns TRUE when all the values returned by the subquery
match the condition specified in the query?

a. SOME
b. ALL
c. AND
d. LIKE

Question 23: Which of the following operator is used to join the data from two or more tables with different
structure?

a. Union
b. Except
c. Intersect
d. Joins

Question 24: Which of the following set operator returns the values in the first table in the query that has no
identical values in the second table?

a. EXCEPT
b. INTERSECT
c. UNION
d. COMPLEMENT

Question 25: Which of the following statement is true about UNION ALL set operator in T-SQL?

a. It does not remove duplicate rows from the tables.


b. It exhibits slow performance compared to UNION set operator.
c. It combines the data fetched from multiple tables and displays it as a single unit.
d. It returns distinct rows with data that are common in both the first and second tables.

Question 26: If three students get a denserank() of 1 , what is the rank of next best student?

a. 4
b. 2
c. 5
d. 1
Question 27: Consider that there are ten rows in Table1 and five rows in Table2, then how many rows will the
result of a CROSS JOIN query on these tables have?

a. 5
b. 15
c. 20
d. 50

Question 28: Which of the following join clause can be used to obtain unmatched rows from the second table
along with matched rows from both tables?

a. CROSS JOIN
b. LEFT OUTER JOIN
c. RIGHT OUTER JOIN
d. FULL JOIN

Question 29: Which of the following data types cannot be used as expressions when a comparison operator is
used between them?

a. text
b. ntext
c. nchar
d. image

Question 30: Which function helps to find the average marks obtained by students from the marks stored in the
students_information table?

a. Max
b. Min
c. Avg
d. Sum

Question 31: Which of the following statement is used to add new records to a table in a database?

a. ADD
b. INSERT
c. APPEND
d. ADD ON
Question 32: Which of the following statements are true about INSERT statement?

a. It is possible to add values for all the columns of the table without specifying the column names in the
INSERT statement provided that the order of the values is in the same order as the columns in the table.
b. If a column is not specified in the INSERT statement and if that column allows null value, the database
engine will add a null value in the column.
c. INTO is a required argument that must be placed between the INSERT keyword and the table name.
d. It is not possible to insert data from one table to another using the INSERT query.

Question 33: Which of the following clause is essential while using an aggregate function?

a. Order By
b. Group By
c. Over
d. Where

Question 34: Which of the following clause can be used in UPDATE statement that specifies the columns to
update and the new values for the columns?

a. ALTER
b. MODIFY
c. SET
d. ASSIGN

Question 35: Consider that you have created a ‘Customer’ table with columns ‘cust_id’ and ‘cust_name’, and
you have inserted 5 rows of data into the ‘Customer’ table. Which of the following query will delete only the
first two rows of data in the Customer table?

a. DELETE TOP(2) ROWS FROM Customer


b. DELETE FROM Customer TOP(2)
c. DELETE FIRST(2) FROM Customer
d. DELETE TOP(2) FROM Customer

Question 36: Which of the following function helps to find the number of students in a school from the
schoolstudents table?

a. COUNT(*)
b. DISTINCT
c. AVG
d. SUM
Question 37: Which of the following statements are true about MERGE statement?

a. It is possible to update the target table with the data in the source table when the rows in the target
and source tables match.
b. It is possible to insert rows into the target table when the target table contains rows that are not
present in the source table.
c. It is possible to update the target table with the source table when the target table does not have all
the rows present in the source table.
d. Insert, update, and delete operations can be handled using a single MERGE statement.

Question 38: If Table1 has three rows and Table2 has 5 rows, a cross join between these two tables will result in
______ rows.

a. 5
b. 6
c. 10
d. 2

Question 39: Which of the following aggregate functions does not ignore null values that are included in the
specified expression?

a. SUM
b. MIN
c. MAX
d. COUNT

Question 40: In a group of 10 cities, consider that four cities record the same temperature on a day and rank
first for being hot cities for the day. What is the rank of the city which gets the next highest temperature, if
NTile(2) function is used in the query?

a. 2
b. 3
c. 4
d. 1

Question 41: Which of the following options are ranking functions in T-SQL?

a. ROW_NUMBER()
b. NTILE(N)
c. DENSE_RANK()
d. COLUMN_NUMBER()
Question 42: In a student database where student information is stored, the query 'Select count(*),country
from student_info group by country' returns ______.

a. Number of Countries
b. Number of students from each country along with the name of the country
c. Number of students
d. Number of rows in student_info

Question 43: Which of the following option is not the parameter of the SUBSTRING function?

a. START
b. END
c. LENGTH
d. STRING

Question 44: Consider that you have created a table ‘Customer_detail’ with columns ‘Cust_id’,
‘Customer_name’, ‘Cust_addr’. Which of the following query will convert the strings in the ‘Customer_name’
column to upper case and the strings in the ‘Cust_addr’ column to lower case?

a.

b.

c.

d.
Question 45: The output of the REVERSE('SQLSERVER') function will be ____________.

a. SERVER SQL
b. REVRESLQS
c. LQSREVRES
d. LSQ VERRES

Question 46: Which of the following component of DATETIME function displays the fractional seconds?

a. ss
b. sss
c. nnn
d. nn

You might also like