+ All Categories
Home > Documents > Data Type Supported by DBMS

Data Type Supported by DBMS

Date post: 15-Oct-2014
Category:
Upload: jinu220
View: 24 times
Download: 5 times
Share this document with a friend
13
Data type supported by DBMS:- 1. Numeric: Numeric data are the data on which you can perform arithmetic procedure. EX: STD_HRS, SALARY. We can perform arithmetic manipulations like add, subtract, multiply and divide. 2. Character: Character data contains any character or symbol. Ex: STD_LASTNAME, STD_FNAME 3. Date: Date attribute contains calendar date. Ex: STD_DOB 4. Logical: Logical data can have a true or false condition. Oracle: 1. Number SAL Number(5) -No. of digit to be LEAVE RollNo Number(3) Price Number(4,2) 2. Char char(20) -fixed length
Transcript
Page 1: Data Type Supported by DBMS

Data type supported by DBMS:-

1. Numeric: Numeric data are the data on which you can perform arithmetic

procedure. EX: STD_HRS, SALARY. We can perform arithmetic manipulations

like add, subtract, multiply and divide. 2. Character: Character data contains any character or symbol. Ex: STD_LASTNAME, STD_FNAME3. Date: Date attribute contains calendar date. Ex: STD_DOB4. Logical: Logical data can have a true or false condition.

Oracle:

1. Number SAL Number(5) -No. of digit to be LEAVE RollNo Number(3) Price Number(4,2)2. Char char(20) -fixed length varchar(20) -variable length3. Date DD-MON-YY BLOB: Binary Large Object CLOB: Character large object

Page 2: Data Type Supported by DBMS

A columns range of permissible values is called as domain. each table must have a primary key which uniquely identifies each row.

Keys:

1. Candidate key2. Super key3. Primary key

Candidate key:

A candidate key is described as a super key that is a minimal super key. A primary key is the candidate key chosen to be uniquely identified. So, primary key is a super key as well as candidate key.

Super key:

A super key is any key that uniquely identifies each row.

Composite Key:

A key Composed of more than one attribute is known as composite key.

Foreign Key:

An attribute or a combination of attributes in one table whose values must match the primary key in another table or be null.

Secondary key:

Secondary key is defined as an attribute or combination of attributes used for data retrieval.

CREATE TABLE EMP (Empno Number(3), Sal Number(5), Name varchar2(20), DOB date);

Page 3: Data Type Supported by DBMS

CREATE TABLE STUDENT (Rollno Number(3), Name varchar2(20), DOB Date, Address varchar(20), Telno Number(10));

Integrity Rules:

1. Entity Integrity: Requirement: All Primary key entries are unique and no part of

primary key can be null. Purpose: Each row will have a unique identify and foreign key

values can reference primary key value. Example: No invoice can have a duplicate number or can be NULL.2. Referential Integrity: Requirement: A Foreign key may have either a null entry or an

entry that matches the primary key value in a table to which it is related.

Purpose: It is impossible to make an invalid entry. Example: A customer is assign sales representative number which

cannot be invalid.

Relational Set Operator:

1. Union Union combines all rows from two tables excluding duplicate

rows. The tables must have columns and domains identical when two or

more table share the same number of columns, when the columns have same name and same domain they are called as union compatible.

A B

1

Page 4: Data Type Supported by DBMS

2

A UNION B

2. Intersect Intersect gives the rows that appears in both the tables. The

tables must be UNION compatible to get valid result.

E_NAMEGJW

Yields

3. Difference

F_NAMEGJE

3

1 23

F_NAMEJWD

F_NAMEJW

F_NAMEGEW

Page 5: Data Type Supported by DBMS

W

4. Product Product gives all possible pairs of rows from two tables called as

cartesion product. If one table has six rows and other table has three rows product gives 18 rows.

Difference gives all rows in one table. It subtracts one table from other. It should be UNION compatible to get valid result.

5. Select Select (Restrict) gives value for all rows found in a table. It lists all

the row values or the rows that match specific condition SELECT gives a horizontal subset of a Table.

6. Project Project gives all values for selected attribute. Project gives vertical

subset of a table.

7. Join It allows the information to be continued from two or more

tables. The types of join are :I. Natural Join

It is a three stage process of product, select, project.

EMPEMPNO ENAME DEPTNO1 ABC 102 DAC 20

F_NAMEJAD

Page 6: Data Type Supported by DBMS

DEPTDEPTNO DNAME10 SALES20 HR

EMP PRODUCTEMPNO ENAME DEPTNO DNAME1 ABC 10 SALES1 ABC 10 HR2 DAC 20 SALES2 DAC 20 HR

SELECT EMP

EMP_NO Ename Deptno Deptno Dname1 ABC 10 10 Sales2 DAC 20 20 HR

EMP.DEPTNO = DEPT.DEPTNOEXAMPLE:

STUDENTROLLNO DEPTNO SNAME1 5 SHAH2 6 PATEL

DEPT5 Bca 46 Bba 5

Product

ROLLNO DEPTNO SNAME DEPTNO DNAME LOC

Page 7: Data Type Supported by DBMS

1 5 SHAH 5 BCA 42 6 PATEL 6 BBA 51 5 SHAH 6 BBA 52 6 PATEL 5 BCA 4

SELECT

1 5 SHAH 5 BCA 42 6 PATEL 6 BBA 5

STUDENT.DEPTNO=DEPT.DEPTNO A natural join links the table with common values in their

common attribute.PRODUCT: It performs a Cartesian product on both the tables. SELECT: A SELECT is perform where the common attributes have common value, the common columns are called join column. PROJECT: It is perform to give the vertical subset of each attribute by removing duplicate column. II. Equi Join

It joins the table based on equality condition. It does not remove duplicate columns and the condition for join should be given explicitly. We use equality comparison operator (=) for the join operation.

III. Theta Join If any other comparison operator is used, it is called as theta join.

IV. Left Outer Join

Page 8: Data Type Supported by DBMS

Left outer join gives all the rows in the left table including those that do not match with the value in the right table.

V. Right Outer Join It gives all the rows in the right table including those that do not

have matching value in the left table.

VI. Divide

Code LocA 5C 7D 8E 6

DIVIDE requires one single column and one two column table.

Data Dictionary and System Catalog:

Data Dictionary provides detailed accounting of all tables found in the database. It gives the attribute name and properties of each table in the system.

System catalog contains metadata it is a detailed system data dictionary that describes all objects in the database including data about table names, table creator, no. of columns in each table, data type, and authorized users.

Homonym: Similar sounding words with different meaning.Ex: fair (good) (festival)

Synonym: It is opposite of homonym it uses different names to describe the same attribute.

Relationship within relational database:

Page 9: Data Type Supported by DBMS

1. 1:1 – One to One

One store – one Manager

1 Dept – 1 Dept Head

2. 1:M – One to Many

CRS_NO CRS_NAME1 BCA2 BBA

DEPT EMPP.K.DEPT_NO EMP_NO-P.K DNAME DEPT_NO-F.K

CRS_NO

CLASS_ID

1 6022 502

Page 10: Data Type Supported by DBMS

DEP STUPK DEPTNO STUID-PK DNAME DEPTNO-FK

3. M:M – Many to Many

SUPPNO SNAMES100 S1S101 S2

Index:

It is defined as orderly arrangement used to logically access rows in a table.

PRODNO

PNAME

1 RADIO

SUPPNO PRODNO PRICES100 1 1000S101 2 1500


Recommended