Dbms Theory
Dbms Theory
----
Theory qns
----------
1. Database and its need
2. Relational Data Model
3. Relation, domain
4. Attribute
5. Tuple
6. Degree
7. Cardinlaity
8. Primary key, Candidate key, alternate key,foreign key
9. SQL
10. DDL
11. DML
12. DISTINCT
13. AS(aliasing)
14. IS,IN,LIKE,BETWEEN-AND
15. diff b/w alter(ddl) and update(dml)
16. diff b/w delete(dml) and drop(ddl) ddl commands can't rollback, it is
automatically committed. but dml commands can rollback
17. joins (cross,equi,natural)
18. order by and group by
19. where and having
20. aggregate functions (sum, avg,min,max,count)
21. functions that work only on numeric type -----sum,avg
22. functions that work on all data type--min,max,count
23. char and varchar
24. table constraint(not null,unique,primary key)
SQL Commands
--------------
1. create table table-name(colname datatype[(size)] [constraint-name], colname
datatype[(size)] [constraintname],................);
char/varchar----need size
datatype-----------int(integer),char,varchar,float,date
char[(n)]
varchar(n)
#student(rno,name,grade,section)
alter table student add primary key(rno);
#student(name,grade,section)
alter table student add(rno int primary key);
joins
------
Table T1(rno,name,grade), Table T2(rno,mark)
cross join: degree : sum of the degree of two relations, cardinality : product of
cardinality of two relations
select * from t1,t2;
or
select * from t1 cross join t2;
or
select * from t1 join t2;
equi join:
select * from t1,t2 where t1.rno=t2.rno;
natural join
select * from t1 natural join t2;