SQL Notes
SQL Notes
emp
--------
empid, ename,desig, sal, depcode,dob,city
=======
join
select c1,c2,c3,c4..........
from table1
[left / right / full outer] join table2
on table1.col=table2.col
student
------------
id,name,phone,email,course
marks
----------
id, score
===========
sub query
----------
an sql query inside another sql query
=========================
uniqe key-- column will not accept duplicates ( 1 null value is allowed)
can have multiple unique keys on a table.
ex:
emp ( empid, ename,sal, desig, depcode)------
empid is primarykey,
depcode is foreignkey refer to depcode in dept table
ex:
delete emp where empid='5674'
truncate table emp
drop table emp
what is null in db
select title,price,pub_name
from titles t
join publishers p
on t.pub_id=p.pub_id
select title,price,pub_name,au_lname+au_fname
from titles t
join publishers p
on t.pub_id=p.pub_id
join titleauthor ta
on ta.title_id=t.title_id
join authors a
on a.au_id=ta.au_id