Steps:
Enter username, password for Oracle(scott,tiger)
You will see something like this
SQL>
Start writing SQL
Create database
1)Database
SQL>create database <database name>
Eg.
SQL>create database pp
Press enter to create database
Create Table in database
2)Table
SQL>create table <table name>
Eg.
SQL>create table xx(nm varchae(5),roll varchar(5));
Table created msg displayed
Insert rows into table
3)Insert
SQL>insert into <table name>values('xx','yy');
Enter
Eg.
SQL>insert into xx values('shobhna','001');
Enter
Msg displayed: 1 row created
SQL>insert into xx values ('cc','002');
Msg displayed: 1 row created
And so on you can insert records in table
4)Select
Select query is used to display rows in table
SQL>select * from xx;
NM ROLL
----------------------------
Shobhna 001
cc 002
dd 003
5)Update
SQL>update xx set roll='005' where nm='dd';
Msg displayed: 1 row updated
SQL>select * from xx;
NM ROLL
----------------------------
Shobhna 001
cc 002
dd 005->previously 003,now 005
6)Delete
Delete from <table name> where nm='Shobhna';
7)Drop
Drop table<table name>;
Enter username, password for Oracle(scott,tiger)
You will see something like this
SQL>
Start writing SQL
Create database
1)Database
SQL>create database <database name>
Eg.
SQL>create database pp
Press enter to create database
Create Table in database
2)Table
SQL>create table <table name>
Eg.
SQL>create table xx(nm varchae(5),roll varchar(5));
Table created msg displayed
Insert rows into table
3)Insert
SQL>insert into <table name>values('xx','yy');
Enter
Eg.
SQL>insert into xx values('shobhna','001');
Enter
Msg displayed: 1 row created
SQL>insert into xx values ('cc','002');
Msg displayed: 1 row created
Similarly
SQL>insert into xx values ('dd','003');
Msg displayed: 1 row createdAnd so on you can insert records in table
4)Select
Select query is used to display rows in table
SQL>select * from xx;
NM ROLL
----------------------------
Shobhna 001
cc 002
dd 003
5)Update
SQL>update xx set roll='005' where nm='dd';
Msg displayed: 1 row updated
SQL>select * from xx;
NM ROLL
----------------------------
Shobhna 001
cc 002
dd 005->previously 003,now 005
6)Delete
Delete from <table name> where nm='Shobhna';
7)Drop
Drop table<table name>;
Eg.
Drop table items;
No comments:
Post a Comment