5890733369
5890733369
1. All attribute combination inside a relation 1. A candidate key that is not the primary
that can serve as primary key are called as key is called Alternate key.
candidate key. 2. In a table two or more candidate keys,
2. They are candidates for the primary key only one of the server as primary key the
position. rest of them are alternate key.
DDL DML
1. It allows performing task related to data 1. It allows manipulating data from the
definition. relation.
2. Using this command we can create, alter 2. Using this command we can manipulate
and drop the schema object (Table) the data from existing schema object
3. Ex: Create, Alter and Drop (Table).
3. Ex: Select, Insert, Update, Delete
5. Differentiate: Alter Command and Update Command.
1. It is used to add, delete and modify the 1. It is used to update the existing records
attributes (column) of a table. in a table.
2. It will perform the action on structure 2. It will perform the action on data level.
level. 3. It is used to change data into the table.
3. It is used to modify the structure of the 4. It is a DML command
table. 5. Ex: update stu set cs_mark=95 where
4. It is a DDL command. Rollno=105;
5. Ex: alter table stu add email
varchar(25);
Order by Group by
1. It is used to sort the records either 1. It is used to group the records that have
ascending or descending order. identical values.
2. Not mandatory to use aggregate function. 2. It is mandatory to use aggregate
3. Result set is stored based on the column function in group by clause.
attribute values either ascending or 3. Grouping is done based on similar
descending order. values among the rows attribute values.
4. Ex: select Empname, Salary from emp 4. Ex: select city, max(salary) from emp
order by Salary desc; group by city;
9. Differentiate: Where Clause and Having Clause.
Where Having
1. It filters the individual rows. 1. It filters the groups of instead of one
2. We cannot use where clause with row at a time.
aggregate function because it works on 2. It works with aggregate functions.
individual row. 3. It handles the column operations to
3. It handles row operation. summarized groups.
Commit Rollback
1. A commit statement is used to save 1. A Rollback statement is used to undo
changes on the current transaction is all the changes.
permanent. 2. Rollback statement occurs when the
2. Commit statement is applied when the transaction is either aborted power
transaction is completed. failure.
Char ( ) Varchar ( )
1. It is fixed length fields. 1. It is variable length fields.
2. It occupies fixed number of bytes for 2. Length is determined separately for
every data elements. every data elements inside the field.
3. There is wastage of space. 3. There is no wastage of space.
4. Value is shorter than the length blanks 4. Every value stored in column exactly.
space added. 5. Ex: name varchar(20)
5. Ex: name char(10)
Attribute Domain
1. An attribute is a column that represents an 1. Domain is a pool of values that can
entity. be assigned to an attribute.
2. It helps to describe an entity. 2. It helps to define the range of
values that set off a specific
attribute.
Fetchone ( ) Fetchall ( )
1. In this method, it fetches only one record 1. In this method, it fetches all the
from the result set. record from the result set.
2. The return type is tuple. 2. The return type is list of tuple.