0% found this document useful (0 votes)
65 views

Tushar Dbms

The document shows SQL commands being used to connect to a database, create a table, insert and update data in the table, and alter the table structure. It connects as the system user, creates a table with three columns, inserts and updates sample data, and alters the table by adding, modifying, renaming and dropping a column.

Uploaded by

Vaibhav Karambe
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

Tushar Dbms

The document shows SQL commands being used to connect to a database, create a table, insert and update data in the table, and alter the table structure. It connects as the system user, creates a table with three columns, inserts and updates sample data, and alters the table by adding, modifying, renaming and dropping a column.

Uploaded by

Vaibhav Karambe
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 6

SQL*Plus: Release 10.2.0.1.

0 - Production on Tue Aug 20 22:11:16 2019

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> connect

Enter user-name:

ERROR:

ORA-01017: invalid username/password; logon denied

SQL>

SQL> system

SP2-0042: unknown command "system" - rest of line ignored.

SQL> connect

Enter user-name: system

Enter password:

Connected.

SQL> create table emp1(id number,name varchar(20),salary number,);

create table emp1(id number,name varchar(20),salary number,)

ERROR at line 1:

ORA-00904: : invalid identifier


SQL> create table emp1(id number,name varchar(20),salary number);

Table created.

SQL> desc emp1;

Name Null? Type

----------------------------------------- -------- ----------------------------

ID NUMBER

NAME VARCHAR2(20)

SALARY NUMBER

SQL> insert into emp1 values('1','sagar','40000');

1 row created.

SQL> select * from emp1;

ID NAME SALARY

---------- -------------------- ----------

1 sagar 40000

SQL> insert into emp1 values('2','sangam','45000');

1 row created.
SQL> insert into emp1 values('3','sanket','35000');

1 row created.

SQL> select * from emp1;

ID NAME SALARY

---------- -------------------- ----------

1 sagar 40000

2 sangam 45000

3 sanket 35000

SQL> update into emp1 set salary='50000' where name='sagar'

2 select * from emp1;

update into emp1 set salary='50000' where name='sagar'

ERROR at line 1:

ORA-00903: invalid table name

SQL> update emp1 set salary='50000' where name='sagar'

2 select * from emp1;

select * from emp1

ERROR at line 2:
ORA-00933: SQL command not properly ended

SQL> update into emp1 set salary='50000' where name='sagar';

update into emp1 set salary='50000' where name='sagar'

ERROR at line 1:

ORA-00903: invalid table name

SQL> update emp1 set salary='50000' where name='sagar';

1 row updated.

SQL> select * from emp1;

ID NAME SALARY

---------- -------------------- ----------

1 sagar 50000

2 sangam 45000

3 sanket 35000

SQL> alter table emp1 add call_no number;

Table altered.
SQL> select * from emp1;

ID NAME SALARY CALL_NO

---------- -------------------- ---------- ----------

1 sagar 50000

2 sangam 45000

3 sanket 35000

SQL> alter table emp1 modify call_no varchar(12);

Table altered.

SQL> select * from emp1;

ID NAME SALARY CALL_NO

---------- -------------------- ---------- ------------

1 sagar 50000

2 sangam 45000

3 sanket 35000

SQL> alter table emp1 rename column call_no to phone_no;

Table altered.
SQL> select * from emp1;

ID NAME SALARY PHONE_NO

---------- -------------------- ---------- ------------

1 sagar 50000

2 sangam 45000

3 sanket 35000

SQL> alter table emp1 drop column phone_no;

Table altered.

SQL> select * from emp1;

ID NAME SALARY

---------- -------------------- ----------

1 sagar 50000

2 sangam 45000

3 sanket 35000

SQL>

You might also like