TOP 50
Cisco SQL
Structured Query Language
Interview Questions and Answers
www.nitizsharma.com
Q1: What is SQL?
A1:
SQL (Structured Query Language) is a language used to
manage and manipulate relational databases, including
querying, updating, and deleting data.
Q2: What is a Primary Key in SQL?
A2:
A primary key uniquely identifies each record in a database
table, ensuring no duplicate values and enforcing entity
integrity.
Q3: What is a Foreign Key in SQL?
A3:
A foreign key is a column that establishes a relationship
between two tables by referencing the primary key of another
table.
Q4: What is the difference between DELETE and TRUNCATE?
A4:
DELETE removes rows based on a condition and can be rolled
back, while TRUNCATE removes all rows and cannot be rolled
back.
Q5: What is a Join in SQL?
A5:
A JOIN combines rows from two or more tables based on a
related column, like an ID, to fetch data.
www.nitizsharma.com
Q6: Explain the types of Joins in SQL.
A6:
INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN are the main
types used to combine tables with different conditions.
Q7: What is the difference between UNION and UNION ALL?
A7:
UNION removes duplicate records, while UNION ALL includes all
records, even duplicates, from both queries.
Q8: What is normalization in SQL?
A8:
Normalization is the process of organizing data to reduce
redundancy and dependency by dividing large tables into
smaller ones.
Q9: What is denormalization in SQL?
A9:
Denormalization is the process of combining tables to improve
read performance at the cost of storage efficiency.
Q10: What is an Index in SQL?
A10:
An index is a data structure that improves the speed of data
retrieval operations on a database table.
www.nitizsharma.com
Q11: What is a View in SQL?
A11:
A view is a virtual table based on the result of a SELECT query
that can simplify complex queries.
Q12: What is a Trigger in SQL?
A12:
A trigger is a stored procedure that automatically executes when
specific events like INSERT, UPDATE, or DELETE occur.
Q13: What are Aggregate Functions in SQL?
A13:
Aggregate functions perform calculations on multiple rows of a
table to return a single value, e.g., COUNT, SUM, AVG.
Q14: What is a Subquery in SQL?
A14:
A subquery is a query nested inside another query, used to return
data that is used by the outer query.
Q15: What is a Self Join in SQL?
A15:
A self-join is a join where a table is joined with itself, typically
using aliases to differentiate the instances.
www.nitizsharma.com
Q16: What is the difference between VARCHAR and CHAR?
A16:
VARCHAR stores variable-length strings, while CHAR stores
fixed-length strings, padding with spaces if needed.
Q17: What is an SQL Injection?
A17:
SQL injection is a malicious attack that exploits vulnerable SQL
queries by inserting or altering SQL code to manipulate
databases.
Q18: What is the use of GROUP BY in SQL?
A18:
GROUP BY groups rows that share a property and allows
aggregate functions to perform operations on each group.
Q19: What is the difference between WHERE and HAVING?
A19:
WHERE filters rows before grouping, while HAVING filters
groups after aggregation.
Q20: What is a Constraint in SQL?
A20:
A constraint is a rule that limits the types of data that can be
inserted into a table, e.g., UNIQUE, CHECK.
www.nitizsharma.com
Q21: What is the difference between an INNER JOIN and a LEFT
JOIN?
A21:
INNER JOIN returns only matching rows, while LEFT JOIN returns
all rows from the left table, with NULLs for unmatched rows.
Q22: What is the difference between a Clustered and Non-
clustered Index?
A22:
A clustered index determines the physical order of data in the
table, while a non-clustered index creates a separate structure.
Q23: What is a Data Dictionary in SQL?
A23:
A data dictionary stores metadata about the database's
structure, including tables, columns, data types, and
relationships.
Q24: What are SQL Data Types?
A24:
SQL data types define the kind of data stored in a column, such
as INT, VARCHAR, DATE, and BOOLEAN.
www.nitizsharma.com
Q25: What is a Composite Key in SQL?
A25:
A composite key consists of two or more columns used
together to uniquely identify records in a table.
Q26: What is a Normal Form in SQL?
A26:
A normal form is a set of guidelines to organize database tables
and reduce redundancy and dependency, e.g., 1NF, 2NF, 3NF.
Q27: What is a Foreign Key Constraint?
A27:
A foreign key constraint ensures that a value in one table
corresponds to a valid record in another table, maintaining
referential integrity.
Q28: What is the use of the DISTINCT keyword in SQL?
A28:
DISTINCT eliminates duplicate records in a result set, returning
only unique values in the query output.
Q29: What is the difference between an Alias and a View?
A29:
An alias temporarily renames a table or column for a query,
while a view is a stored, reusable query result.
www.nitizsharma.com
Q30: What is the purpose of the COALESCE function?
A30:
COALESCE returns the first non-null expression from a list of
arguments, useful for handling NULL values.
Q31: What is the purpose of the RANK() function?
A31:
RANK() assigns a rank to each row within a partition, with gaps
in ranking for ties.
Q32: What is a Cursor in SQL?
A32:
A cursor is a database object used to retrieve and manipulate
query results row by row in a controlled manner.
Q33: What is the difference between SQL and PL/SQL?
A33:
SQL is used for querying databases, while PL/SQL is Oracle's
procedural language extension for SQL, adding logic and
control flow.
Q34: What are Stored Procedures in SQL?
A34:
Stored procedures are precompiled SQL statements stored in
the database, used to perform repetitive tasks efficiently.
www.nitizsharma.com
Q35: What is the difference between UNION and INTERSECT?
A35:
UNION combines all results from two queries, removing
duplicates, while INTERSECT returns only the common records
from both queries.
Q36: What are Temporary Tables in SQL?
A36:
Temporary tables are created during a session and stored in
memory or disk, automatically dropped when the session ends.
Q37: What is an Outer Join?
A37:
An outer join returns matching rows from both tables and non-
matching rows, filling the missing side with NULLs.
Q38: What is a Batch in SQL?
A38:
A batch is a group of one or more SQL statements executed
together as a single unit.
www.nitizsharma.com
Q39: What is the difference between an OLTP and OLAP
system?
A39:
DoS uses a single machine to overload a target, while DDoS
uses multiple machines (botnet) for a more powerful attack.
Q40: What is a Query Execution Plan?
A40:
A query execution plan is a detailed roadmap used by the
database engine to execute a query efficiently, showing
operations like joins and sorts.
Q41: What is the difference between SQL and NoSQL?
A41:
SQL is relational and uses structured query language, while
NoSQL is non-relational, offering flexibility for unstructured or
semi-structured data.
Q42: What is the BETWEEN operator in SQL?
A42:
BETWEEN selects values within a given range, inclusive of the
boundary values, used with numeric, date, and string types.
www.nitizsharma.com
Q43: What are Aggregate Functions?
A43:
Aggregate functions perform calculations on multiple rows,
returning a single value, such as COUNT, SUM, AVG, MIN, and
MAX.
Q44: What is a Scalar Function?
A44:
A scalar function operates on a single value and returns a single
result, such as UPPER(), LOWER(), or LENGTH().
Q45: What is a Deadlock in SQL?
A45:
A deadlock occurs when two or more transactions block each
other by holding locks that the other transactions need.
Q46: What is the difference between CAST and CONVERT?
A46:
CAST and CONVERT are both used to change data types, but
CONVERT allows additional formatting options in SQL Server.
www.nitizsharma.com
Q47: What is the function of the HAVING clause in SQL?
A47:
HAVING is used to filter groups after aggregation, while WHERE
filters rows before aggregation.
Q48: What is a Subquery?
A48:
A subquery is a query nested inside another query, typically
used to retrieve a value for comparison or as a condition.
Q49: What are Transactions in SQL?
A49:
Transactions are sequences of SQL statements executed as a
unit, ensuring data integrity with properties like ACID
(Atomicity, Consistency, Isolation, Durability).
Q50: What is the use of the EXISTS keyword in SQL?
A50:
EXISTS is used to check whether a subquery returns any rows,
typically used in conditions to test data existence.
www.nitizsharma.com
📌Save this post
To Visit Cisco SQL interview questions
before your next Big Interview!
www.nitizsharma.com