Top 15 SQL Interview Questions And Answer - Part 1 -textpound


Top 15 SQL Interview Questions & Answers


Top 15 SQL Interview Questions And Answer
Top 15 SQL Interview Questions And Answer



1. What is SQL?

SQL stands for Structured Query Language.SQL is a standard language for accessing and manipulating databases.It is used for database creation, deletion, fetching rows and modifying rows etc.



2. what are SQL Constraints?

SQL constraints are used to specify rules for the data in a table.
Constraints are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the table.

The following constraints are commonly used in SQL:

NOT NULL -  column cannot have a NULL value
UNIQUE - Ensures that all values in a column are different
PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table
FOREIGN KEY - Uniquely identifies a row/record in another table
INDEX - Use to create and retrieve data from the database very quickly



3. what is SQL DEFAULT Constraint?

The DEFAULT constraint is used to provide a default value for a column.
The default value will be added to all new records IF no other value is specified.



4. What Can SQL do?

  • SQL can update records in a database
  • SQL can delete records from a database
  • SQL can create new databases
  • SQL can retrieve data from a database
  • SQL can insert records in a database
  • SQL can create stored procedures in a database
  • SQL can create views in a database
  • SQL can set permissions on tables and views
  • SQL can create new tables in a database



5.  what are Some of the most important SQL Commands?

  • CREATE DATABASE - creates a new database
  • ALTER DATABASE - modifies a database
  • SELECT - extracts data from a database
  • UPDATE - updates data in a database
  • DELETE - deletes data from a database
  • INSERT INTO - inserts new data into a database
  • CREATE TABLE - creates a new table
  • ALTER TABLE - modifies a table
  • DROP TABLE - deletes a table


6. what is the SQL SELECT Statement?

The SELECT statement is used to select data from a database.
SELECT Syntax

SELECT column1, column2, ...
FROM table_name;


7.  What are the type of operators available in SQL?

  • Arithmetic operators
  • Logical operators
  • Comparison operator

8.  Write an SQL query to find names of employee start with 'A'?

SELECT * FROM Employees WHERE EmpName like 'A%' 

9. what is the SQL EXISTS Operator?

The EXISTS operator is used to test for the existence of any record in a subquery.

The EXISTS operator returns true if the subquery returns one or more records.

EXISTS Syntax

SELECT column_name(s)
FROM table_name
WHERE EXISTS
(SELECT column_name FROM table_name WHERE condition); 


10. What is "TRIGGER" in SQL?

 Triggers are special type of stored procedures that are defined to execute automatically in place or after data modifications.

 11. What are the subsets of SQL?

  • Data definition language (DDL)
  • Data manipulation language (DML)
  • Data control language (DCL)

12. When SQL appeared?

It appeared in 1974.

 13. what is the SQL LIKE Operator?

The LIKE operator is used in a WHERE clause to search for a specified pattern in a column.

There are two wildcards used in conjunction with the LIKE operator:

% - The percent sign represents zero, one, or multiple characters
_ - The underscore represents a single character.

LIKE Syntax

SELECT column1, column2, ...
FROM table_name
WHERE columnN LIKE pattern;


14.what is the SQL WHERE Clause?

The WHERE clause is used to filter records.

The WHERE clause is used to extract only those records that fulfill a specified condition.
WHERE clause is used in SELECT, UPDATE, DELETE statement etc.

WHERE Syntax:

SELECT column1, column2, ...
FROM table_name
WHERE condition;

 Example:


SELECT username,email FROM users where id=3.



Top 15 Java interview Questions & Answers - Part 1 


Top 15 Computer Science Interview Question & Answers







Post a Comment

0 Comments