Interview Q From YouTube SQL
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
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).
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.
• 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