Q #1) What is SQL?

 Structured Query Language SQL is a database tool that is used to create and access the database to support software applications.

Q #2) What are tables in SQL?

Tables are database objects that contain all the data in a database. In tables, data is logically organized in a row-and-column format similar to a spreadsheet. Each row represents a unique record, and each column represents a field in the record.

Q #3) What are the different types of statements supported by SQL?

Types of SQL Statements

 
SQL statements are categorized into four different types of statements, which are
  1. DML (DATA MANIPULATION LANGUAGE)
  2. DDL (DATA DEFINITION LANGUAGE)
  3. DCL (DATA CONTROL LANGUAGE)
  4. TCL (TRANSACTION CONTROL LANGUAGE)

1. DML

 

In Data Manipulation Language(DML), we have four different SQL statements,

  • Select
  • Insert
  • Update, and Delete.

2. DDL

 

 In Data Definition Language (DDL), we have three different SQL statements.

 CREATE

 CREATE statement is used to create a new table in an existing database. CREATE statement is also used to create other database object such as a stored procedure, function, etc.

ALTER

 Alter statement can add a column, modify a column, drop a column, rename a column or rename a table.

  DROP

 SQL DROP TABLE statement is used to remove a table definition and all the data, indexes, triggers, constraints and permission specifications for the table.

 TRUNCATE

 TRUNCATE SQL query removes all rows from a table, without logging the individual row deletions.

3. DCL

 In Data Control Language(DCL), it defines the control over the data in the database. We have two different commands, which are

 GRANT

 Grant is allowed to do the specified user to the specified tasks.

REVOKE

 It is used to cancel previously granted or denied permissions.

4. TCL

 

In Transaction Control Language (TCL), the commands are used to manage the transactions in the database. These are used to manage the changes made by DML statements. It also allows the statements to be grouped together into logical transactions.

COMMIT

Commit command is used to permanently save any transaction into the database.

ROLLBACK

Rollback command is used to restore the database for the last committed state. It’s also used with a save point to jump to the save point.

 

Q #4) How do we use the DISTINCT statement? What is its use?

  • The DISTINCT statement is used with the SELECT statement.
  • Distinct is used to remove the duplicate record from a select statement if contains any

 

Select Distinct (PhoneNumber) from TblEmployee

Q #5) What are the different Clauses used in SQL?

As per SQL Official Site : 

There Are Following Clauses 

Q #6) Why do we use SQL constraints? Which constraints we can use while creating a database in SQL?

Answer: Constraints are used to set the rules for all records in the table. If any constraints get violated then it can abort the action that caused it.

Constraints are defined while creating the database itself with the CREATE TABLE statement or even after the table is created once with the ALTER TABLE statement.

There are 5 major constraints are used in SQL, such as

  • NOT NULL: That indicates that the column must have some value and cannot be left NULL.
  • UNIQUE: This constraint is used to ensure that each row and column has a unique value and no value is being repeated in any other row or column.
  • PRIMARY KEY: This constraint is used in association with NOT NULL and UNIQUE constraints such as on one or the combination of more than one column to identify the particular record with a unique identity.
  • FOREIGN KEY: It is used to ensure the referential integrity of data in the table. It matches the value in one table with another using the PRIMARY KEY.
  • CHECK: It ensures whether the value in columns fulfills the specified condition.

More Details 

.

Q #7) What are different JOINS used in SQL?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #8) What are transactions and their controls?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #9) What are the properties of the transaction?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #10) How many Aggregate functions are available in SQL?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #11) What are Scalar functions in SQL?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #12) What are triggers?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #13) What is View in SQL?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #14) How we can update the view?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #15) Explain the working of SQL Privileges?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #16) How many types of Privileges are available in SQL?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #17) What is SQL Injection?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #18) What is SQL Sandbox in SQL Server?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #19) What is the difference between SQL and PL/SQL?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #20) What is the difference between SQL and MySQL?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #21) What is the use of the NVL function?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #22) What is the Cartesian product of the table?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #23) What do you mean by Subquery?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #24) How many row comparison operators are used while working with a subquery?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #25) What is the difference between clustered and non-clustered indexes?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #26) What is the difference between DELETE and TRUNCATE?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #27) What is the difference between DROP and TRUNCATE?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #28) How to write a query to show the details of a student from Students table whose<br /> name start with K?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #29) What is the difference between Nested Subquery and Correlated Subquery?

Your content goes here. Edit or remove this text inline or in the module Content settings. You can also style every aspect of this content in the module Design settings and even apply custom CSS to this text in the module Advanced settings.

Q #30) What is Normalization? How many Normalization forms are there?

Answer: 

I will Update the Soon 

Q #30) What is Normalization? How many Normalization forms are there?

Answer: 

I will Update the Soon 

Q #31) What is a Relationship? How many types of Relationships are there?

Answer: 

I will Update the Soon 

Q #32) What do you mean by Stored Procedures? How do we use it?

Answer: 

I will Update the Soon 

Q #33) State some properties of Relational databases?

Answer: 

I will Update the Soon 

Q #34) What are Nested Triggers?

Answer: 

I will Update the Soon 

Q #35) What is a Cursor?

Answer: 

I will Update the Soon 

Q #36) What is Collation?

Answer: 

I will Update the Soon 

Q #37) What do we need to check in Database Testing?

Answer: 

I will Update the Soon 

Q #38) What is Database White Box Testing?

Answer: 

I will Update the Soon 

Q #39) What is Database Black Box Testing?

Answer: 

I will Update the Soon 

Q #40) What are Indexes in SQL?

Answer: 

I will Update the Soon 

Q #41) Define join and name different types of joins?

Answer: 

I will Update the Soon 

Q #45) How do you add a column to a table?

Answer: 

I will Update the Soon 

Q #46) Define the SQL DELETE statement.

Answer: 

I will Update the Soon 

Q #47) Define COMMIT?

Answer: 

I will Update the Soon 

Q #48) What is the Primary key?

Answer: 

I will Update the Soon 

Q #49) What are Foreign keys?

Answer: 

I will Update the Soon 

Q #50) What is CHECK Constraint?

Answer: 

I will Update the Soon 

Q #51) Is it possible for a table to have more than one foreign key?

Answer: 

I will Update the Soon 

Q #52) What are the possible values for the BOOLEAN data field?

Answer: 

I will Update the Soon 

Q #53) What is a stored procedure?

Answer: 

I will Update the Soon 

Q #54) What is identity in SQL?

Answer: 

I will Update the Soon 

Q #55) What is Normalization?

Answer: 

I will Update the Soon 

Q #56) What is a Trigger?

Answer: 

I will Update the Soon 

Q #57) How to select random rows from a table?

Answer: 

I will Update the Soon 

Q #60) Explain DML and DDL?

Answer: 

I will Update the Soon 

Q #61) Can we rename a column in the output of the SQL query?

Answer: 

I will Update the Soon 

Q #62) Give the order of SQL SELECT?

Answer: 

I will Update the Soon 

Q #65) Difference between TRUNCATE, DELETE and DROP commands?

Answer: 

I will Update the Soon 

Q #67) What do you mean by ROWID?

Answer: 

I will Update the Soon 

Q #68) Define UNION, MINUS, UNION ALL, INTERSECT?

Answer:

  • MINUS – returns all distinct rows selected by the first query but not by the second.
  • UNION – returns all distinct rows selected by either query
  • UNION ALL – returns all rows selected by either query, including all duplicates.
  • INTERSECT – returns all distinct rows selected by both queries.
Q #69) What is a transaction?

Answer: 

A transaction is a sequence of code that runs against a database. It takes the database from one consistent state to another.

Q #70) What is the difference between UNIQUE and PRIMARY KEY constraints?

Answer: 

  • A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys.
  • The primary key cannot contain Null values whereas the Unique key can contain Null values.
Q #71) What is a composite primary key?

Answer: 

The primary key created on more than one column is called composite primary key.

Q #72) What is an Index?

Answer: 

An Index is a special structure associated with a table to speed up the performance of queries. The index can be created on one or more columns of a table.