BCA-II (DBMS) Practical/Lab:- WT:(9:45-11:00)
Login in Oracle 10g software:
Open oracle 10g software:
press window button
type "go to " and click on oracle software.
User ID: system
Password: oracle10g
To create User:
Syntax:
create user <username> identified by <password>;
Example:
create user Ram identified by ram12345;
To display all the tables in oracle:
select * from tab;
To display the content of the table:
select * from student;
To see the schema (columnName, datatype, size of a table)
desc student;
To create a table in oracle:
Syntax:
create table <tableName>
(
attribute1 datatype(size),
attribute2 datatype(size)
);
Example:
create table student
(
rollno varchar2(10),
name varchar2(20)
);
To insert data into a table:
Syntax:
INSERT INTO table_name (column_list)
VALUES( value_list);
Example:
insert into student values (1, 'Ram');
To insert another row:
insert into student values(1, "Mohan");
To insert multiple rows in a table at a time:
Syntax:
Syntax
INSERT ALL
INTO table_name (column1, column2, column_n) VALUES (expr1, expr2, expr_n)
INTO table_name(column1, column2, column_n) VALUES (expr1, expr2, expr_n)
INTO table_name (column1, column2, column_n) VALUES (expr1, expr2, expr_n)
SELECT * FROM dual;
Example:
INSERT ALL
INTO Products ( ProductId, ProductName, Price ) VALUES ( 1, 'Left Handed Screwdriver', 10.50 )
INTO Products ( ProductId, ProductName, Price ) VALUES ( 2, 'Right Handed Screwdriver', 22.75 )
INTO Products ( ProductId, ProductName, Price ) VALUES ( 3, 'Bottomless Coffee Cup (4 pack)', 15.00 )
INTO Products ( ProductId, ProductName, Price ) VALUES ( 4, 'Urban Dictionary Version 2.3', 75 )
INTO Products ( ProductId, ProductName, Price ) VALUES ( 5, 'Beer Water', 15 )
SELECT 1 FROM dual;
To delete table:
drop table <tableName>
To delete data from table:
Syntax:
DELETE FROM table_name
WHERE [condition];
Example:
delete from student
where rollno =1;
Comments
Post a Comment