In this blog we are going to understand the important and basic concepts of SQL...
1.How can we create composite key?
- The PRIMARY KEY constraint uniquely identifies each record in a table.
- The combination of two or more columns that are used for unique identification of row in table.
- A composite key specifies multiple columns for a primary-key.
2.How to write simple SQL with where clause?
- Firstly type the select query required column name,table name and where clause.
- In this, where clause is used to put condition and get specific records.
- The WHERE clause is used to filter records.
Example:
3.How to select specific column name in select query?
- To select required column or we can say specific column we have to declare column name and from which table do you need it
Example:
Output:
4.What is an ALIAS in SQL Server?
ALIAS 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.
Example:
5.What is difference between Inner join vs Left join vs Right join?
Inner Join:
INNER JOIN keyword selects all rows from both the tables as long as the condition satisfies. Inner join displays the matching records from two or more tables.
Example:
Left Join:
This join returns all the rows from left table combine with the matching rows of the right table. If you get no matching in the right table it returns NULL values.
Example:
this join returns all the rows from right table are combined with the matching rows of left table .If you get no column matching in the left table .it returns null value.
Example:
No comments:
Post a Comment