SQL Ass2
SQL Ass2
Table created.
Table created.
Table created.
SQL> select *
2 from tab;
7 rows selected.
ALTER :
Table altered.
desc food
Name Null? Type
----------------------------------------------------- --------
------------------------------------
FID NOT NULL NUMBER(2)
ITEM NOT NULL VARCHAR2(20)
PRICE NOT NULL NUMBER(5)
COLOUR NOT NULL VARCHAR2(10)
Table altered.
desc food
Name Null? Type
----------------------------------------------------- --------
------------------------------------
FID NOT NULL NUMBER(2)
ITEM NOT NULL VARCHAR2(20)
AMT NOT NULL NUMBER(5)
COLOUR NOT NULL VARCHAR2(10)
Table altered.
select *
2 from tab;
RENAME COMMAND :
Table renamed.
7 rows selected.
TRUNCATE COMMAND:
Table truncated.
select *
2 from employee;
no rows selected
DROP COMMAND:
Table dropped.
SQL> select *
2 from tab;
7 rows selected.
Flashback complete.
SQL> select *
2 from tab;
7 rows selected.
Table dropped.
6 rows selected.
Table renamed.
DML:
INSERT CPMMAND:
1 row created.
1 row created.
1 row created.
1 row created.
select *
2 from food;
1 row created.
UPDATE COMMAND:
update food
2 set item = 'rice bath'
3 where fid = 50;
1 row updated.
SQL> select *
2 from food;
DELETE COMMAND:
1 row deleted.
SQL> select *
2 from food;
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select *
2 from tab;
8 rows selected.
Table renamed.
SQL> select *
2 from tab;
8 rows selected.
SQL> select *
2 FROM LAPTOP;
14 rows selected.
no rows selected
1 row created.
1 row created.
1 row created.
1 row created.
SQL> select *
2 from food;
1 row updated.
SQL> select *
2 from food;
1 row updated.
1 row deleted.
SQL> select *
2 from food;
SQL> COMMIT;
Commit complete.
SQL> ROLLBACK
2 ROLLBACK;
ROLLBACK
*
ERROR at line 2:
ORA-02181: invalid option to ROLLBACK WORK
SQL> ROLLBACK;
Rollback complete.
SQL> select *
2 from food;
SQL> select *
2 from food;
1 row created.
SQL> SAVEPOINT I;
Savepoint created.
SQL> select *
2 from food;
1 row updated.
SQL> SAVEPOINT U;
Savepoint created.
SQL> select *
2 from food;
SQL> ROLLBACK TO U;
Rollback complete.
SQL> select *
2 from food;
SQL> ROLLBACK TO I;
Rollback complete.
SQL> select *
2 from food;
----> DCL
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
8 rows selected.
Grant succeeded.
SQL> CONN
Enter user-name: HR
Enter password:
Connected.
SQL> select *
2 from emp;
from emp
*
ERROR at line 2:
ORA-00942: table or view does not exist
SQL> select *
2 from scott.emp;
14 rows selected.
SQL> conn
Enter user-name: scott
Enter password:
Connected.
SQL> select *
2 FROM TAB;
8 rows selected.
Revoke succeeded.
SQL> CONN
Enter user-name: HR
Enter password:
Connected.
SQL> select *
2 from scott.emp;
from scott.emp
*
ERROR at line 2:
ORA-00942: table or view does not exist