FREE Manual Testing Batch Starts in Enroll Now | +91-8143353888 | +91-7780122379

SQL Online Training

  • Q1: What is SQL?
    A: SQL stands for Structured Query Language. It is a programming language used to manage and manipulate relational databases.
  • Q2: What is a database?
    A: A database is a structured collection of data that is organized and stored for easy access, management, and retrieval.
  • Q3: What are the different types of SQL statements?
    A: The different types of SQL statements are: SELECT: Retrieves data from a database, INSERT: Inserts data into a database, UPDATE: Modifies existing data in a database, DELETE: Deletes data from a database, CREATE: Creates a new database object, ALTER: Modifies the structure of a database object, DROP: Deletes a database object
  • Q4: What is a primary key?
    A: A primary key is a unique identifier for each record in a table. It ensures that each row in a table is uniquely identifiable.
  • Q5: What is a foreign key?
    A: A foreign key is a column or a set of columns in a table that refers to the primary key of another table. It establishes a relationship between the two tables.
  • Q6: What is normalization?
    A: Normalization is the process of organizing data in a database to eliminate redundancy and dependency. It ensures that data is efficiently stored and eliminates data anomalies.
  • Q7: What is the difference between SQL and MySQL?
    A: SQL is a programming language used to manage and manipulate relational databases. MySQL, on the other hand, is an open-source relational database management system (RDBMS) that uses SQL as its programming language.
  • Q8: What is a join?
    A: A join is used to combine rows from two or more tables based on a related column between them. It allows you to retrieve data from multiple tables simultaneously.
  • Q9: What are the different types of joins?
    A: The different types of joins are: INNER JOIN: Retrieves records that have matching values in both tables, LEFT JOIN: Retrieves all records from the left table and the matching records from the right table, RIGHT JOIN: Retrieves all records from the right table and the matching records from the left table, FULL JOIN: Retrieves all records when there is a match in either the left or right table.
  • Q10: What is the difference between a primary key and a unique key?
    A: Both primary key and unique key ensure the uniqueness of data, but the primary key is used to uniquely identify each record in a table, while a unique key allows for the uniqueness of data but does not serve as the primary identifier.
  • Q11: What is a subquery?
    A: A subquery is a query nested within another query. It is used to retrieve data that depends on the results of another query.
  • Q12: What is the difference between DELETE and TRUNCATE statements?
    A: The DELETE statement is used to delete specific rows from a table, while the TRUNCATE statement is used to remove all rows from a table, effectively resetting the table.
  • Q13: What is a view?
    A: A view is a virtual table derived from the result of a query. It acts as a stored query that can be used to retrieve data from one or more tables.
  • Q14: What is a stored procedure?
    A: A stored procedure is a named set of SQL statements that are stored in a database. It allows you to perform complex database operations and can be called and executed multiple times.
  • Q15: What is the difference between UNION and UNION ALL?
    A: UNION is used to combine the result sets of two or more SELECT statements, removing duplicates, while UNION ALL combines the result sets of two or more SELECT statements, including duplicates.
  • Q16: What is a transaction?
    A: A transaction is a sequence of SQL statements that are treated as a single unit. It ensures that all the statements are executed successfully or none of them are executed at all.
  • Q17: What is ACID in the context of database transactions?
    A: ACID stands for Atomicity, Consistency, Isolation, and Durability. It is a set of properties that guarantee reliable processing of database transactions.
  • Q18: What is the difference between CHAR and VARCHAR data types?
    A: CHAR is a fixed-length data type that stores a specific number of characters, while VARCHAR is a variable-length data type that stores a varying number of characters.
  • Q19: What is the difference between a clustered index and a non-clustered index?
    A: A clustered index determines the physical order of data in a table, while a non-clustered index is a separate structure that points to the physical location of data in a table.
  • Q20: What is a constraint in SQL?
    A: A constraint is a rule defined on a column or a table that enforces data integrity. It can be used to enforce uniqueness, referential integrity, or check constraints on data.
  • Q21: What is the HAVING clause used for?
    A: The HAVING clause is used to filter data based on a condition in a GROUP BY query. It is similar to the WHERE clause but operates on grouped results.
  • Q22: What is the difference between a stored procedure and a function?
    A: A stored procedure is used to perform database operations and does not necessarily return a value, while a function is used to compute and return a single value.
  • Q23: What is the difference between a single-row function and a multi-row function?
    A: A single-row function operates on single rows and returns a single result, while a multi-row function operates on multiple rows and returns a single result.
  • Q24: What is the difference between the MINUS and EXCEPT operators?
    A: The MINUS operator is used in Oracle, while the EXCEPT operator is used in SQL Server and PostgreSQL. Both operators are used to subtract the result of one query from another.
  • Q25: What is the difference between the UNION and JOIN operators?
    A: The UNION operator combines the result sets of two or more SELECT statements into a single result set, while the JOIN operator is used to retrieve data from multiple tables based on a related column between them.
  • Q26: What is the difference between a database and a schema?
    A: A database is a collection of related data, while a schema is a logical container within a database that separates and organizes objects, such as tables, views, and procedures.
  • Q27: What is the difference between the EXISTS and IN operators?
    A: The EXISTS operator is used to check the existence of a subquery result, while the IN operator is used to compare a value with a list of values returned by a subquery.
  • Q28: What is a self-join?
    A: A self-join is a join operation where a table is joined with itself. It is used when you want to combine rows from the same table based on a related column.
  • Q29: What is the purpose of the GROUP BY clause?
    A: The GROUP BY clause is used to group rows based on one or more columns in a SELECT statement. It is typically used in conjunction with aggregate functions to perform calculations on grouped data.
  • Q30: What is the difference between the WHERE and HAVING clauses?
    A: The WHERE clause is used to filter rows before grouping them, while the HAVING clause is used to filter rows after grouping them. The WHERE clause operates on individual rows, while the HAVING clause operates on grouped results.
  • Q31: What is the difference between a correlated subquery and a non-correlated subquery?
    A: A correlated subquery refers to a column from the outer query within the subquery, while a non-correlated subquery does not depend on the outer query.
  • Q32: What is the difference between a temporary table and a table variable?
    A: A temporary table is a table that is created and exists for the duration of a session or transaction, while a table variable is a variable with a table data type that exists within the scope of a batch or a stored procedure.
  • Q33: What is the difference between a full outer join and a cross join?
    A: A full outer join retrieves all records from both tables, including unmatched rows, while a cross join returns the Cartesian product of both tables, resulting in a combination of all rows.
  • Q34: What is the purpose of the CASE statement in SQL?
    A: The CASE statement is used to perform conditional logic in SQL. It allows you to perform different actions based on different conditions.
  • Q35: What is the difference between a candidate key and a composite key?
    A: A candidate key is a unique identifier for a table, while a composite key is a combination of two or more columns that collectively form a unique identifier for a table.
  • Q36: What is the difference between the LIKE and IN operators?
    A: The LIKE operator is used to compare a value with a pattern using wildcard characters, while the IN operator is used to compare a value with a list of values.
  • Q37: What is the difference between the UNION and UNION ALL operators?
    A: The UNION operator combines the result sets of two or more SELECT statements, removing duplicates, while the UNION ALL operator combines the result sets, including duplicates.
  • Q38: What is the difference between a clustered index and a non-clustered index?
    A: A clustered index determines the physical order of data in a table, while a non-clustered index is a separate structure that points to the physical location of data.
  • Q39: What is the purpose of the ORDER BY clause?
    A: The ORDER BY clause is used to sort the result set of a SELECT statement based on one or more columns in ascending or descending order.
  • Q40: What is the difference between the UNION and JOIN operators?
    A: The UNION operator combines the result sets of two or more SELECT statements into a single result set, while the JOIN operator is used to retrieve data from multiple tables based on a related column between them.
  • Q41: What is a self-join?
    A: A self-join is a join operation where a table is joined with itself. It is used when you want to combine rows from the same table based on a related column.
  • Q42: What is a correlated subquery?
    A: A correlated subquery is a subquery that refers to a column from the outer query within its own query. It is used to filter rows based on conditions from the outer query.
  • Q43: What is the purpose of the GROUP BY clause?
    A: The GROUP BY clause is used to group rows based on one or more columns in a SELECT statement. It is typically used in conjunction with aggregate functions to perform calculations on grouped data.
  • Q44: What is the difference between the WHERE and HAVING clauses?
    A: The WHERE clause is used to filter rows before grouping them, while the HAVING clause is used to filter rows after grouping them. The WHERE clause operates on individual rows, while the HAVING clause operates on grouped results.
  • Q45: What is the difference between the EXISTS and IN operators?
    A: The EXISTS operator is used to check the existence of a subquery result, while the IN operator is used to compare a value with a list of values returned by a subquery.
  • Q46: What is the difference between a temporary table and a table variable?
    A: A temporary table is a table that is created and exists for the duration of a session or transaction, while a table variable is a variable with a table data type that exists within the scope of a batch or a stored procedure.
  • Q47: What is the purpose of the CASE statement in SQL?
    A: The CASE statement is used to perform conditional logic in SQL. It allows you to perform different actions based on different conditions.
  • Q48: What is the difference between a candidate key and a composite key?
    A: A candidate key is a unique identifier for a table, while a composite key is a combination of two or more columns that collectively form a unique identifier for a table.
  • Q49: What is the difference between the LIKE and IN operators?
    A: The LIKE operator is used to compare a value with a pattern using wildcard characters, while the IN operator is used to compare a value with a list of values.
  • Q50: What is the difference between the UNION and UNION ALL operators?
    A: The UNION operator combines the result sets of two or more SELECT statements, removing duplicates, while the UNION ALL operator combines the result sets, including duplicates.
  • Q51: What is the difference between a clustered index and a non-clustered index?
    A: A clustered index determines the physical order of data in a table, while a non-clustered index is a separate structure that points to the physical location of data.
  • Q52: What is the purpose of the ORDER BY clause?
    A: The ORDER BY clause is used to sort the result set of a SELECT statement based on one or more columns in ascending or descending order.
  • Q53: What is the difference between the UNION and JOIN operators?
    A: The UNION operator combines the result sets of two or more SELECT statements into a single result set, while the JOIN operator is used to retrieve data from multiple tables based on a related column between them.
  • Q54: What is a self-join?
    A: A self-join is a join operation where a table is joined with itself. It is used when you want to combine rows from the same table based on a related column.
  • Q55: What is a correlated subquery?
    A: A correlated subquery is a subquery that refers to a column from the outer query within its own query. It is used to filter rows based on conditions from the outer query.
  • Q56: What is the purpose of the GROUP BY clause?
    A: The GROUP BY clause is used to group rows based on one or more columns in a SELECT statement. It is typically used in conjunction with aggregate functions to perform calculations on grouped data.
  • Q57: What is the difference between the WHERE and HAVING clauses?
    A: The WHERE clause is used to filter rows before grouping them, while the HAVING clause is used to filter rows after grouping them. The WHERE clause operates on individual rows, while the HAVING clause operates on grouped results.
  • Q58: What is the difference between the EXISTS and IN operators?
    A: The EXISTS operator is used to check the existence of a subquery result, while the IN operator is used to compare a value with a list of values returned by a subquery.
  • Q59: What is the difference between a temporary table and a table variable?
    A: A temporary table is a table that is created and exists for the duration of a session or transaction, while a table variable is a variable with a table data type that exists within the scope of a batch or a stored procedure.
  • Q60: What is the purpose of the CASE statement in SQL?
    A: The CASE statement is used to perform conditional logic in SQL. It allows you to perform different actions based on different conditions.
  • Q61: What is the difference between a candidate key and a composite key?
    A: A candidate key is a unique identifier for a table, while a composite key is a combination of two or more columns that collectively form a unique identifier for a table.
  • Q62: What is the difference between the LIKE and IN operators?
    A: The LIKE operator is used to compare a value with a pattern using wildcard characters, while the IN operator is used to compare a value with a list of values.
  • Q63: What is the difference between the UNION and UNION ALL operators?
    A: The UNION operator combines the result sets of two or more SELECT statements, removing duplicates, while the UNION ALL operator combines the result sets, including duplicates.
  • Q64: What is the difference between a clustered index and a non-clustered index?
    A: A clustered index determines the physical order of data in a table, while a non-clustered index is a separate structure that points to the physical location of data.
  • Q65: What is the purpose of the ORDER BY clause?
    A: The ORDER BY clause is used to sort the result set of a SELECT statement based on one or more columns in ascending or descending order.
  • Q66: What is the difference between the UNION and JOIN operators?
    A: The UNION operator combines the result sets of two or more SELECT statements into a single result set, while the JOIN operator is used to retrieve data from multiple tables based on a related column between them.
  • Q67: What is a self-join?
    A: A self-join is a join operation where a table is joined with itself. It is used when you want to combine rows from the same table based on a related column.
  • Q68: What is a correlated subquery?
    A: A correlated subquery is a subquery that refers to a column from the outer query within its own query. It is used to filter rows based on conditions from the outer query.
  • Q69: What is the purpose of the GROUP BY clause?
    A: The GROUP BY clause is used to group rows based on one or more columns in a SELECT statement. It is typically used in conjunction with aggregate functions to perform calculations on grouped data.
  • Q70: What is the difference between the WHERE and HAVING clauses?
    A: The WHERE clause is used to filter rows before grouping them, while the HAVING clause is used to filter rows after grouping them. The WHERE clause operates on individual rows, while the HAVING clause operates on grouped results.
  • Q71: What is the difference between the EXISTS and IN operators?
    A: The EXISTS operator is used to check the existence of a subquery result, while the IN operator is used to compare a value with a list of values returned by a subquery.
  • Q72: What is the difference between a temporary table and a table variable?
    A: A temporary table is a table that is created and exists for the duration of a session or transaction, while a table variable is a variable with a table data type that exists within the scope of a batch or a stored procedure.
  • Q73: What is the purpose of the CASE statement in SQL?
    A: The CASE statement is used to perform conditional logic in SQL. It allows you to perform different actions based on different conditions.
  • Q74: What is the difference between a candidate key and a composite key?
    A: A candidate key is a unique identifier for a table, while a composite key is a combination of two or more columns that collectively form a unique identifier for a table.
  • Q75: What is the difference between the LIKE and IN operators?
    A: The LIKE operator is used to compare a value with a pattern using wildcard characters, while the IN operator is used to compare a value with a list of values.
  • Q76: What is the difference between the UNION and UNION ALL operators?
    A: The UNION operator combines the result sets of two or more SELECT statements, removing duplicates, while the UNION ALL operator combines the result sets, including duplicates.
  • Q77: What is the difference between a clustered index and a non-clustered index?
    A: A clustered index determines the physical order of data in a table, while a non-clustered index is a separate structure that points to the physical location of data.
  • Q78: What is the purpose of the ORDER BY clause?
    A: The ORDER BY clause is used to sort the result set of a SELECT statement based on one or more columns in ascending or descending order.
  • Q79: What is the difference between the UNION and JOIN operators?
    A: The UNION operator combines the result sets of two or more SELECT statements into a single result set, while the JOIN operator is used to retrieve data from multiple tables based on a related column between them.
  • Q80: What is a self-join?
    A: A self-join is a join operation where a table is joined with itself. It is used when you want to combine rows from the same table based on a related column.
  • Q81: What is a correlated subquery?
    A: A correlated subquery is a subquery that refers to a column from the outer query within its own query. It is used to filter rows based on conditions from the outer query.
  • Q82: What is the purpose of the GROUP BY clause?
    A: The GROUP BY clause is used to group rows based on one or more columns in a SELECT statement. It is typically used in conjunction with aggregate functions to perform calculations on grouped data.
  • Q83: What is the difference between the WHERE and HAVING clauses?
    A: The WHERE clause is used to filter rows before grouping them, while the HAVING clause is used to filter rows after grouping them. The WHERE clause operates on individual rows, while the HAVING clause operates on grouped results.
  • Q84: What is the difference between the EXISTS and IN operators?
    A: The EXISTS operator is used to check the existence of a subquery result, while the IN operator is used to compare a value with a list of values returned by a subquery.
  • Q85: What is the difference between a temporary table and a table variable?
    A: A temporary table is a table that is created and exists for the duration of a session or transaction, while a table variable is a variable with a table data type that exists within the scope of a batch or a stored procedure.
  • Q86: What is the purpose of the CASE statement in SQL?
    A: The CASE statement is used to perform conditional logic in SQL. It allows you to perform different actions based on different conditions.
  • Q87: What is the difference between a candidate key and a composite key?
    A: A candidate key is a unique identifier for a table, while a composite key is a combination of two or more columns that collectively form a unique identifier for a table.
  • Q88: What is the difference between the LIKE and IN operators?
    A: The LIKE operator is used to compare a value with a pattern using wildcard characters, while the IN operator is used to compare a value with a list of values.
  • Q89: What is the difference between the UNION and UNION ALL operators?
    A: The UNION operator combines the result sets of two or more SELECT statements, removing duplicates, while the UNION ALL operator combines the result sets, including duplicates.
  • Q90: What is the difference between a clustered index and a non-clustered index?
    A: A clustered index determines the physical order of data in a table, while a non-clustered index is a separate structure that points to the physical location of data.
  • Q91: What is the purpose of the ORDER BY clause?
    A: The ORDER BY clause is used to sort the result set of a SELECT statement based on one or more columns in ascending or descending order.
  • Q92: What is the difference between the UNION and JOIN operators?
    A: The UNION operator combines the result sets of two or more SELECT statements into a single result set, while the JOIN operator is used to retrieve data from multiple tables based on a related column between them.
  • Q93: What is a self-join?
    A: A self-join is a join operation where a table is joined with itself. It is used when you want to combine rows from the same table based on a related column.
  • Q94: What is a correlated subquery?
    A: A correlated subquery is a subquery that refers to a column from the outer query within its own query. It is used to filter rows based on conditions from the outer query.
  • Q95: What is the purpose of the GROUP BY clause?
    A: The GROUP BY clause is used to group rows based on one or more columns in a SELECT statement. It is typically used in conjunction with aggregate functions to perform calculations on grouped data.
  • Q96: What is the difference between the WHERE and HAVING clauses?
    A: The WHERE clause is used to filter rows before grouping them, while the HAVING clause is used to filter rows after grouping them. The WHERE clause operates on individual rows, while the HAVING clause operates on grouped results.
  • Q97: What is the difference between the EXISTS and IN operators?
    A: The EXISTS operator is used to check the existence of a subquery result, while the IN operator is used to compare a value with a list of values returned by a subquery.
  • Q98: What is the difference between a temporary table and a table variable?
    A: A temporary table is a table that is created and exists for the duration of a session or transaction, while a table variable is a variable with a table data type that exists within the scope of a batch or a stored procedure.
  • Q99: What is the purpose of the CASE statement in SQL?
    A: The CASE statement is used to perform conditional logic in SQL. It allows you to perform different actions based on different conditions.
  • Q100: What is the difference between a candidate key and a composite key?
    A: A candidate key is a unique identifier for a table, while a composite key is a combination of two or more columns that collectively form a unique identifier for a table.