0% found this document useful (0 votes)
16 views5 pages

Interview Q From YouTube SQL

The document provides a series of interview questions and answers related to SQL, covering topics such as SQL definition, DDL, DML, primary and foreign keys, and various types of joins. It explains the purpose of SQL commands like UNION, GROUP BY, BETWEEN, and the HAVING clause. Additionally, it highlights the importance of primary keys and foreign keys in database management.

Uploaded by

bhamrekashyap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

Interview Q From YouTube SQL

The document provides a series of interview questions and answers related to SQL, covering topics such as SQL definition, DDL, DML, primary and foreign keys, and various types of joins. It explains the purpose of SQL commands like UNION, GROUP BY, BETWEEN, and the HAVING clause. Additionally, it highlights the importance of primary keys and foreign keys in database management.

Uploaded by

bhamrekashyap
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Interview Q from YouTube SQL

1) What is sql
Ans=SQL is structure query language is used to store
database using relational database is call relational
database.
2) What us ddl dml.
Ans=ddl is data definition language in this data define in
particulare commands are the commands we use for and
commands is CREATE ALTER
And coming to dml
Dml is data manipulation language in this we manipulate
data by using there are three commands DELETE INSERT
UPDATE
And coming to dcl
Dcl is data control language in this we. We have 2
commands those are GRANT REVOKE

3) What is primary key.


Ans= The primary key in SQL is a single, or a group of fields
or columns that can uniquely identify a row in a table.
Putting it simply, it is a column that accepts unique values
for each row.
The PRIMARY KEY constraint uniquely identifies each
record in a table.
Primary keys must contain UNIQUE values, and cannot
contain NULL values.
A table can have only ONE primary key; and in the table,
this primary key can consist of single or multiple columns
(fields).

4)
5) What is foreign key.
A FOREIGN KEY is a field (orThe PRIMARY KEY constraint uniquely
identifies each record in a table.

Primary keys must contain UNIQUE values, and cannot contain NULL values.

A table can have only ONE primary key; and in the table, this primary key
can consist of single or multiple columns (fields).

collection of fields) in one table, that refers to the PRIMARY


KEY in another table. The table with the foreign key is called
the child table, and the table with the primary key is called the
referenced or parent table.

1) Inner join
The INNER JOIN keyword selects records that have
matching values in both tables.
2)Left Join
The LEFT JOIN keyword returns all records from the left
table (table1), and the matching records from the right
table (table2). The result is 0 records from the right side,
if there is no match.
3)Right Join
The RIGHT JOIN keyword returns all records from the
right table (table2), and the matching records from
the left table (table1). The result is 0 records from the
left side, if there is no match.
4) Full Join
The FULL OUTER JOIN keyword returns all records
when there is a match in left (table1) or right (table2) table
records.

**Union key
The UNION operator is used to combine the result-set of two
or more SELECT statements.
• Every SELECT statement within UNION must have the
same number of columns
• The columns must also have similar data types
• The columns in every SELECT statement must also be in
the same order.
**Group by
The GROUP BY statement groups rows that have the same values into summary
rows, like "find the number of customers in each country".
The GROUP BY statement is often used with aggregate functions
(COUNT(), MAX(), MIN(), SUM(), AVG()) to group the result-set by one or more
columns.

**Between
he BETWEEN operator selects values within a given
range. The values can be numbers, text, or dates.
The BETWEEN operator is inclusive: begin and end
values are included.
**)Aliases
SQL aliases are used to give a table, or a column in a
table, a temporary name.
Aliases are often used to make column names more
readable.
An alias only exists for the duration of that query.
An alias is created with the AS keyword.

***)The SQL UNION Operator


The UNION operator is used to combine the result-set of two or
more SELECT statements.

• Every SELECT statement within UNION must have the same number of
columns
• The columns must also have similar data types
• The columns in every SELECT statement must also be in the same order

**)Having clause
The HAVING clause was added to SQL because the WHERE keyword
cannot be used with aggregate functions

You might also like