DBMS Recap
DBMS Recap
DBMS Recap
14. Delete: [delete the values] – Deletes a row / specific rows / all the rows but not a
specific column – [structure is not getting affected]
Type 01:[removing the all the row values]
Delete from Product;
16. Drop: [Structure with the data (if present) allows gets deleted] – [1 mark]
Drop table tablename;
Drop database databasename;
Cartesian Product: [no common column – output – no.of rows in table 01 * no.of rows in
table 02]
Natural join: [no need to give and condition – common column appears only once that too
at the front]
mysql> select * from supplier;
+-------+----------+---------+
| supid | sname | city |
+-------+----------+---------+
| 111 | s and co | mumbai |
| 333 | ttt | chennai |
+-------+----------+---------+
2 rows in set (0.00 sec)
Equi join:
For Example:
Employee(Empid#,Ename,Salary,Aadhaar#,Passport#,VoterID#)
Ambiguous Error
mysql> create table Orders
-> (Oid int(1), Ono int(5), Cid int(1));
Query OK, 0 rows affected (0.01 sec)
Theory
DDL DML
Data definition language Data Manipulation Language
It deals with the structure of the data It deals with the data
Commands: CREATE, ALTER AND Commands: INSERT, SELECT, UPDATE, DELETE
DROP
Eg: drop table employee; Eg: delete from employee;
Eg: Alter table employee Eg: Update employee
Add Set
Mobile bigint; Salary = Salary + Salary * 0.25;
ALTER UPDATE
It is a part of DDL command It belongs to DML command
It deals with the structure of the data It deals with the data
Eg: Alter table employee Eg: Update employee
Add Set
Mobile bigint; Salary = Salary + Salary * 0.25;
DROP DELETE
It is a part of DDL command It belongs to DML command
It deals with the structure of the It deals with the data
data
Eg: drop table employee; Eg: delete from employee;
Primary Key Unique Key
It is unique and not null It is unique and cane be null
It helps us to identify a row / tuple It doesn’t help to identify a row– it can also
be null
Employee(Empid#,Ename,Salary,Aadhaar,P Employee(Empid#,Ename,Salary,Aadhaar,P
assport,VoterID,Carno##) assport,VoterID,Carno##)
#Empid – Primary Key ##Carno – Unique Key