Posts

Showing posts from July, 2019

Normalization in sql

Normalization is a database design technique. It reduces redundancy and dependency of data.It divides larger tables into smaller tables and links them using relationships. 4 types of normalizations are used. 1. First Normal Form(1NF ) *Each table cell should have a single value. *Each record should be unique. 2.Second Normal Form(2NF) *It should be 1NF *Primary key column 3.Third Normal Form (3NF) *It should be 2NF *No transitive dependency 4.Boyce code Normal Form *All the colums in the table should be dependent on the super key.

Difference between Sub query and Derived table in Sql

Derived Table * It's used in from clause. *It can have one or more colums *It must be enclosed with parenthesis. *It should have a name (e.g) Select * from (Select employee_name,sum(salary) as wage  from employee group by employee_name)a Sub query *It's used in where clause *It can have only one column *It must be enclosed with parenthesis. (e.g) Select * from employee where employee_id in (select max(employee_salary) from employee)