Oracle: H.K. Vedamurthy Asst Professor Dept of CSE Cit, Gubbi
Oracle: H.K. Vedamurthy Asst Professor Dept of CSE Cit, Gubbi
Savepoint - like markers to divide lengthy transaction to smaller ones. Rollback used to undo the work done in the current transaction.
H.K. Vedamurthy, CSE ,CIT Gubbi 4
Data Types
Number Char
Varchar2
Long Date
H.K. Vedamurthy, CSE ,CIT Gubbi 7
Null Value
Missing/unknown/inapplicable data
Types of Constraints
Column Level Unique Constraint Check Constraint Primary Key Constraint Table Level Foreign Key Constraint
);
12
Implementation of Check Constraint CREATE TABLE EMPLOYEE( EmpNo NUMBER(5) CONSTRAINT PKey4 Primary Key, EmpName Varchar(25) NOT NULL, EmpSalary Number(7) Constraint chk Check (EmpSalary > 0 and EmpSalary <1000000) );
H.K. Vedamurthy, CSE ,CIT Gubbi 14
Implementation of Default CREATE TABLE TABDEF( Ecode Number(4) Not Null, Ename Varchar2(25) Not Null, ECity char(10) DEFAULT Mysore );
15
add modify and drop column Syntax: ALTER TABLE tablename (ADD/MODIFY/DROP column_name)
16
ALTER TABLE Customer_Details ADD CONSTRAINT Pkey2 PRIMARY KEY (Account_No, Cust_ID);
H.K. Vedamurthy, CSE ,CIT Gubbi 18
20
21
Syntax: Insert into <tablename>(column list) values (a list of data values separated by commas);
Operators
Arithmetic operators like +, -, *, /
Logical operators: AND, OR, NOT Relational operators: =, <=, >=, < >, < , >
23
Updating All Rows UPDATE Customer_Fixed_Deposit SET Rate_of_Interest_in_Percent = NULL; Updating Particular rows
UPDATE Customer_Fixed_Deposit SET Rate_of_Interest_in_Percent = 7.3 WHERE Amount_in_Dollars > 3000;
H.K. Vedamurthy, CSE ,CIT Gubbi 25
Update contd.
Updating Multiple Columns
UPDATE Customer_Fixed_Deposit
SET Cust_Email = [email protected] , Rate_of_Interest_in_Percent = 7.3 WHERE Cust_ID = 104
26