Get Membership To Play All Videos In This Website.
Sign-in
Sign-up
Regular
Python
Membership
DataEngineering
Basics
Video Courses
Telugu Language
English Language
Online Test
Python Blog
Interview Questions
Online Test
1). Which SQL command is used to remove all records from a table without removing the table itself??
A) DELETE FROM table_name;
B) DROP TABLE table_name;
C) TRUNCATE TABLE table_name;
D) REMOVE ALL FROM table_name;
2). What is the function of the `EXISTS` operator in SQL??
A) Tests for the existence of any record in a subquery
B) Checks if a column exists
C) Validates the data type of a column
D) Confirms if a table exists
3). Which SQL statement is used to combine the results of two or more SELECT statements??
A) JOIN
B) UNION
C) MERGE
D) APPEND
4). What is the purpose of the `PARTITION BY` clause in SQL??
A) To divide the result set into partitions for analytic functions
B) To partition the database into multiple tables
C) To split a table into multiple columns
D) To create a backup of the database
5). Which SQL clause is used to define a condition for a specific group of records after an aggregation operation??
A) WHERE
B) HAVING
C) GROUP BY
D) ORDER BY
6). What does the `ROW_NUMBER()` function do in SQL??
A) Assigns a unique number to each row within a partition
B) Calculates the total number of rows
C) Summarizes rows into a single value
D) Deletes rows from a table
7). How can you update specific rows in a SQL table based on a condition??
A) UPDATE table_name SET column_name = value WHERE condition;
B) MODIFY table_name SET column_name = value WHERE condition;
C) CHANGE table_name SET column_name = value WHERE condition;
D) ALTER table_name SET column_name = value WHERE condition;
8). Which of the following SQL statements will create an index on a table??
A) CREATE INDEX index_name ON table_name (column_name);
B) ADD INDEX index_name ON table_name (column_name);
C) NEW INDEX index_name ON table_name (column_name);
D) INDEX table_name (column_name);
9). What is the use of the `CROSS APPLY` operator in SQL Server??
A) To join each row from an outer table to rows from a table-valued function
B) To perform a cross join between two tables
C) To apply a filter to a result set
D) To update multiple rows in a table
10). How can you ensure that a column in a SQL table can have only a single NULL value??
A) Use a unique constraint with `NULL` allowed
B) Use a primary key constraint
C) Use a `CHECK` constraint
D) Use an index on the column
11). Which SQL function is used to get the number of rows in a table??
A) COUNT()
B) TOTAL()
C) NUM()
D) ROWS()
12). What is a common use of the `WITH (NOLOCK)` hint in SQL queries??
A) To perform a dirty read without locking the table
B) To lock the table for updates
C) To ensure data consistency
D) To improve query performance
13). Which SQL clause is used to limit the number of rows returned by a query??
A) LIMIT
B) TOP
C) FETCH FIRST
D) ROW_COUNT
14). What is the purpose of the `TRUNCATE` command in SQL??
A) To delete all rows from a table but keep the structure
B) To remove a table from the database
C) To drop a column from a table
D) To update all rows in a table
15). How do you create a view in SQL??
A) CREATE VIEW view_name AS SELECT columns FROM table;
B) NEW VIEW view_name SELECT columns FROM table;
C) DEFINE VIEW view_name AS SELECT columns FROM table;
D) CREATE TABLE view_name AS SELECT columns FROM table;
16). Which SQL function is used to calculate the average value of a numeric column??
A) AVG()
B) MEAN()
C) AVERAGE()
D) SUM()
17). What is a `self-join` in SQL??
A) A join where a table is joined with itself
B) A join between two different tables
C) A join that returns all rows
D) A join that filters records
18). How do you add a new column to an existing SQL table??
A) ALTER TABLE table_name ADD column_name datatype;
B) MODIFY TABLE table_name ADD column_name datatype;
C) UPDATE TABLE table_name ADD column_name datatype;
D) INSERT COLUMN column_name INTO table_name;
19). What does the `UNION ALL` operator do in SQL??
A) Combines the results of two SELECT statements and includes duplicate rows
B) Combines the results of two SELECT statements and removes duplicates
C) Performs a full outer join between two tables
D) Creates a new table by merging two tables
20). Which SQL clause is used to sort the results of a query??
A) ORDER BY
B) SORT
C) GROUP BY
D) ARRANGE BY
21). What is the function of the `GROUP_CONCAT()` function in SQL??
A) Concatenates values from multiple rows into a single string
B) Groups multiple rows into a single row
C) Counts the number of concatenated values
D) Splits a string into multiple rows
22). What is an `INNER JOIN` in SQL??
A) Returns rows that have matching values in both tables
B) Returns all rows from the left table and matched rows from the right table
C) Returns all rows from the right table and matched rows from the left table
D) Returns all rows when there is a match in one of the tables
23). How can you ensure that a column in a SQL table only accepts unique values??
A) Use a UNIQUE constraint
B) Use a PRIMARY KEY constraint
C) Use a FOREIGN KEY constraint
D) Use a CHECK constraint
24). What is a `stored procedure` in SQL??
A) A saved collection of SQL statements that can be executed as a unit
B) A single SQL statement executed once
C) A dynamic query that is executed multiple times
D) A function that returns a result set
25). How do you remove a column from a table in SQL??
A) ALTER TABLE table_name DROP COLUMN column_name;
B) DELETE COLUMN column_name FROM table_name;
C) REMOVE COLUMN column_name FROM table_name;
D) DROP COLUMN column_name FROM table_name;
26). What does the `RANK()` function do in SQL??
A) Assigns a rank to each row within a partition
B) Calculates the total rank of a column
C) Summarizes ranks into a single value
D) Deletes ranks from a table
27). What is a `trigger` in SQL??
A) A set of SQL statements that are automatically executed in response to certain events on a table
B) A manual command executed by a user
C) A function that returns a result set
D) A query that is executed periodically
28). Which SQL statement is used to prevent SQL injection attacks??
A) Use parameterized queries or prepared statements
B) Escape special characters manually
C) Sanitize input by removing HTML tags
D) Encrypt sensitive data
29). What is the purpose of the `HAVING` clause in SQL??
A) To filter records after an aggregation operation
B) To filter records before an aggregation operation
C) To sort records after an aggregation operation
D) To join multiple tables
30). How can you find duplicate rows in a SQL table??
A) Use the `GROUP BY` clause with the `HAVING` clause to identify duplicates
B) Use the `DISTINCT` keyword
C) Use a self-join
D) Use the `UNIQUE` constraint
31). What is the purpose of the `FOREIGN KEY` constraint in SQL??
A) To enforce referential integrity between tables
B) To ensure that values in a column are unique
C) To set default values for a column
D) To automatically update a column's value
32). What does the `LEAD()` function do in SQL??
A) Accesses data from the next row in the result set
B) Accesses data from the previous row in the result set
C) Summarizes data from the current row
D) Deletes data from the current row
33). How do you create a temporary table in SQL??
A) CREATE TEMPORARY TABLE table_name (column_name datatype);
B) CREATE TABLE table_name (column_name datatype) TEMPORARY;
C) TEMPORARY TABLE table_name (column_name datatype);
D) DEFINE TEMPORARY TABLE table_name (column_name datatype);
34). What is a `common table expression (CTE)` in SQL??
A) A temporary result set that can be referenced within a SELECT, INSERT, UPDATE, or DELETE statement
B) A view that is created permanently in the database
C) A stored procedure that returns a result set
D) A function that performs complex calculations
Submit
Test Results