MOTOSHARE 🚗🏍️

Rent Bikes & Cars Directly from Owners

Motoshare connects vehicle owners with people who need bikes and cars on rent. Owners earn from idle vehicles, and renters get flexible ride options.

Visit Motoshare

Top 50 MsSQL Interview Questions with Answers

Uncategorized
MsSQL Interview Questions with Answers
  1. What is MSSQL?

a. A programming language
b. A database management system
c. A web development tool
d. An operating system

Answer: b. A database management system

  1. What is the full form of SQL?

a. Structured Query Language
b. Structured Question Language
c. System Query Language
d. System Question Language

Answer: a. Structured Query Language

  1. What is a database?

a. A collection of spreadsheets
b. A collection of files
c. A collection of interrelated data
d. A collection of executable programs

Answer: c. A collection of interrelated data

  1. What is a primary key?

a. A unique identifier for a table
b. A column that can contain null values
c. A column that is used for sorting data
d. A column that is used for grouping data

Answer: a. A unique identifier for a table

  1. What is a foreign key?

a. A key used to link two tables
b. A key used to perform arithmetic operations
c. A key used to sort data
d. A key used to filter data

Answer: a. A key used to link two tables

  1. Which command is used to create a new table in MSSQL?

a. ADD TABLE
b. CREATE TABLE
c. MAKE TABLE
d. NEW TABLE

Answer: b. CREATE TABLE

  1. Which of the following is not a data type in MSSQL?

a. INT
b. FLOAT
c. DOUBLE
d. CHAR

Answer: c. DOUBLE

  1. Which of the following commands is used to select data from a table?

a. RETRIEVE
b. SELECT
c. FIND
d. SEARCH

Answer: b. SELECT

  1. What is a stored procedure?

a. A function that returns a value
b. A query that cannot be modified
c. A set of SQL statements that can be executed repeatedly
d. A view that can be queried

Answer: c. A set of SQL statements that can be executed repeatedly

  1. Which command is used to delete a table from the database?

a. DROP TABLE
b. DELETE TABLE
c. REMOVE TABLE
d. ERASE TABLE

Answer: a. DROP TABLE

  1. What is a view?

a. A physical table in the database
b. A virtual table that can be queried
c. A stored procedure that returns a value
d. A schema for organizing data

Answer: b. A virtual table that can be queried

  1. Which command is used to add a new column to a table?

a. ADD COLUMN
b. CREATE COLUMN
c. INSERT COLUMN
d. NEW COLUMN

Answer: a. ADD COLUMN

  1. What is normalization?

a. Splitting a large table into smaller tables to reduce redundancy and improve data integrity
b. Combining smaller tables into a larger table to improve performance
c. Adding more data to a table to improve data quality
d. Removing data from a table to reduce its size

Answer: a. Splitting a large table into smaller tables to reduce redundancy and improve data integrity

  1. What is denormalization?

a. Combining smaller tables into a larger table to improve performance
b. Splitting a large table into smaller tables to improve data integrity
c. Adding more data to a table to improve data quality
d. Removing data from a table to reduce its size

Answer: a. Combining smaller tables into a larger table to improve performance

  1. What is a trigger?

a. A stored procedure that is automatically executed in response to certain events
b. A table that stores log information
c. A view that can be queried
d. A command used to update data in a table

Answer: a. A stored procedure that is automatically executed in response to certain events

  1. Which of the following is not a type of trigger in MSSQL?

a. AFTER INSERT
b. BEFORE DELETE
c. AFTER UPDATE
d. BEFORE SELECT

Answer: d. BEFORE SELECT

  1. What is a cursor?

a. A variable that stores data temporarily
b. A type of query that returns a single row of data
c. A mechanism used to iterate over a set of rows returned by a query
d. A command used to modify data in a table

Answer: c. A mechanism used to iterate over a set of rows returned by a query

  1. Which command is used to insert data into a table?

a. ADD
b. CREATE
c. INSERT
d. UPDATE

Answer: c. INSERT

  1. Which command is used to update data in a table?

a. ADD
b. CREATE
c. INSERT
d. UPDATE

Answer: d. UPDATE

  1. Which command is used to delete data from a table?

a. REMOVE
b. DELETE
c. DESTROY
d. ERASE

Answer: b. DELETE

  1. What is a transaction?

a. A set of SQL statements that are executed as a unit
b. An individual SQL statement
c. A group of tables in a database
d. A stored procedure that returns a value

Answer: a. A set of SQL statements that are executed as a unit

  1. Which command is used to commit a transaction?

a. END TRANSACTION
b. CLOSE TRANSACTION
c. FINISH TRANSACTION
d. COMMIT TRANSACTION

Answer: d. COMMIT TRANSACTION

  1. Which command is used to rollback a transaction?

a. END TRANSACTION
b. CLOSE TRANSACTION
c. ROLLBACK TRANSACTION
d. CANCEL TRANSACTION

Answer: c. ROLLBACK TRANSACTION

  1. What is a join?

a. A mechanism used to combine data from two or more tables based on a related column
b. A mechanism used to split data into multiple tables to improve performance
c. A mechanism used to remove duplicate rows from a table
d. A mechanism used to modify data in a table

Answer: a. A mechanism used to combine data from two or more tables based on a related column

  1. Which of the following is not a type of join in MSSQL?

a. INNER JOIN
b. LEFT JOIN
c. RIGHT JOIN
d. CENTER JOIN

Answer: d. CENTER JOIN

  1. What is a clustered index?

a. An index that is created on a non-unique column
b. An index that is created on a unique column
c. An index that determines the physical order of data in a table
d. An index used to perform full-text searches

Answer: c. An index that determines the physical order of data in a table

  1. What is a non-clustered index?

a. An index that is created on a non-unique column
b. An index that is created on a unique column
c. An index that determines the physical order of data in a table
d. An index used to perform full-text searches

Answer: a. An index that is created on a non-unique column

  1. What is a subquery?

a. A query that contains another query
b. A query that returns multiple rows of data
c. A query that returns a single row of data
d. A query that returns no rows of data

Answer: a. A query that contains another query

  1. Which command is used to count the number of rows in a table?

a. COUNT ROWS
b. GET ROWS
c. SELECT COUNT
d. SUM ROWS

Answer: c. SELECT COUNT

  1. Which command is used to sort data in ascending order?

a. SORT ASC
b. ORDER BY ASC
c. ARRANGE ASC
d. ASCENDING

Answer: b. ORDER BY ASC

  1. Which command is used to sort data in descending order?

a. SORT DESC
b. ORDER BY DESC
c. ARRANGE DESC
d. DESCENDING

Answer: b. ORDER BY DESC

  1. What is a function?

a. A stored procedure that returns a value
b. A query that cannot be modified
c. A set of SQL statements that can be executed repeatedly
d. A virtual table that can be queried

Answer: a. A stored procedure that returns a value

  1. Which command is used to create a new database?

a. ADD DATABASE
b. CREATE DATABASE
c. MAKE DATABASE
d. NEW DATABASE

Answer: b. CREATE DATABASE

  1. What is a database schema?

a. A set of rules that defines the structure and behavior of a database
b. A physical table in the database
c. A virtual table that can be queried
d. A stored procedure that returns a value

Answer: a. A set of rules that defines the structure and behavior of a database

  1. Which command is used to create a new user in MSSQL?

a. ADD USER
b. CREATE USER
c. NEW USER
d. MAKE USER

Answer: b. CREATE USER

  1. Which command is used to assign a privilege to a user in MSSQL?

a. GRANT
b. ASSIGN
c. ALLOW
d. PERMIT

Answer: a. GRANT

  1. Which command is used to revoke a privilege from a user in MSSQL?

a. DENY
b. REMOVE
c. REVOKE
d. FORBID

Answer: c. REVOKE

  1. What is a bulk insert?

a. A method used to insert large amounts of data into a table
b. A function used to manipulate data in a table
c. A view that can be queried
d. A set of SQL statements that can be executed repeatedly

Answer: a. A method used to insert large amounts of data into a table

  1. Which command is used to execute a stored procedure?

a. EXECUTE
b. RUN
c. PERFORM
d. DO

Answer: a. EXECUTE

  1. Which command is used to rename a table?

a. RENAME TABLE
b. ALTER TABLE
c. MODIFY TABLE
d. CHANGE TABLE

Answer: b. ALTER TABLE

  1. What is a constraint?

a. A rule that is applied to a table to enforce data integrity
b. A physical table in the database
c. A virtual table that can be queried
d. A stored procedure that returns a value

Answer: a. A rule that is applied to a table to enforce data integrity

  1. Which of the following is not a type of constraint in MSSQL?

a. PRIMARY KEY
b. FOREIGN KEY
c. UNIQUE KEY
d. DUPLICATE KEY

Answer: d. DUPLICATE KEY

  1. What is a trigger in MSSQL?

a. A stored procedure that is automatically executed in response to certain events
b. A table that stores log information
c. A view that can be queried
d. A command used to update data in a table

Answer: a. A stored procedure that is automatically executed in response to certain events

  1. What is a cursor in MSSQL?

a. A variable that stores data temporarily
b. A type of query that returns a single row of data
c. A mechanism used to iterate over a set of rows returned by a query
d. A command used to modify data in a table

Answer: c. A mechanism used to iterate over a set of rows returned by a query

  1. What is a transaction in MSSQL?

a. A set of SQL statements that are executed as a unit
b. An individual SQL statement
c. A group of tables in a database
d. A stored procedure that returns a value

Answer: a. A set of SQL statements that are executed as a unit

  1. What is the difference between BETWEEN and IN operators?

a. BETWEEN is used for numeric values, while IN is used for character values
b. BETWEEN is used for character values, while IN is used for numeric values
c. BETWEEN is used to select values within a range, while IN is used to select values from a set
d. BETWEEN is used to select values from a set, while IN is used to select values within a range

Answer: c. BETWEEN is used to select values within a range, while IN is used to select values from a set

  1. What is the difference between WHERE and HAVING clauses?

a. WHERE is used to filter rows based on conditions, while HAVING is used to filter groups based on conditions
b. WHERE is used to filter groups based on conditions, while HAVING is used to filter rows based on conditions
c. WHERE is used to join tables, while HAVING is used to group rows
d. WHERE is used to sort data, while HAVING is used to select data

Answer: a. WHERE is used to filter rows based on conditions, while HAVING is used to filter groups based on conditions

  1. What is the difference between UNION and UNION ALL operators?

a. UNION combines the result sets and removes duplicate rows, while UNION ALL combines the result sets without removing duplicate rows
b. UNION ALL combines the result sets and removes duplicate rows, while UNION combines the result sets without removing duplicate rows
c. UNION and UNION ALL perform the same operation
d. UNION and UNION ALL cannot be used in MSSQL

Answer: a. UNION combines the result sets and removes duplicate rows, while UNION ALL combines the result sets without removing duplicate rows

  1. What is a temporary table?

a. A table that is created in memory and exists only for the duration of a session
b. A table that is physically created in the database
c. A view that can be queried
d. A stored procedure that returns a value

Answer: a. A table that is created in memory and exists only for the duration of a session

  1. What is a dynamic SQL?

a. A type of query that returns a single row of data
b. A stored procedure that returns a value
c. A set of SQL statements that is built at runtime
d. A query that cannot be modified

Answer: c. A set of SQL statements that is built at runtime

Ashwani Kumar
Latest posts by Ashwani Kumar (see all)
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
0
Would love your thoughts, please comment.x
()
x