Добавил:
Novilit
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:lab2
.txt SQL> connect system/password
Connected.
SQL> create table new_table(
2 number_pole NUMBER(11) NOT NULL,
3 string_pole VARCHAR(35) NOT NULL,
4 number_pole2 NUMBER(11) NOT NULL,
5 string_pole2 NUMBER(35) NOT NULL,
6 key_pole VARCHAR(35) NOT NULL,
7 primary key (key_pole));
Table created.
SQL> create user new_user identified by password
2 default tablespace users
3 temporary tablespace temp
4 quota 10m on users;
User created.
SQL> GRAND CONNECT, RESOURCE, CREATE VIEW TO new_user;
SP2-0734: unknown command beginning "GRAND CONN..." - rest of line ignored.
SQL> GRANT CONNECT, RESOURCE, CREATE VIEW TO new_user;
Grant succeeded.
SQL> GRANT INSERT, UPDATE, DELETE on new_table TO new_user
2 ;
Grant succeeded.
SQL> grant select on system.new_table to new_user;
Grant succeeded.
SQL> connect new_user/password
Connected.
SQL> insert into system.new_table values(1, 'a', 2, 5, 'lkj');
1 row created.
SQL> insert into system.new_table values(1, 'b', 3, 7, 'ghjkl');
1 row created.
SQL> insert into system.new_table values(6, 'c', 8, 9, 'ghggl');
1 row created.
SQL> insert into system.new_table values(0, 'n', 1, 1, 'gsgjhgf');
1 row created.
SQL> insert into system.new_table values(6, 'mk', 12, 5, 'lkjhgfd');
1 row created.
SQL> select number_pole*13 from system.new_table;
NUMBER_POLE*13
--------------
13
13
78
0
78
SQL> select * from system.new_table order by string_pole;
NUMBER_POLE STRING_POLE NUMBER_POLE2 STRING_POLE2
----------- ----------------------------------- ------------ ------------
KEY_POLE
-----------------------------------
1 a 2 5
lkj
1 b 3 7
ghjkl
6 c 8 9
ghggl
NUMBER_POLE STRING_POLE NUMBER_POLE2 STRING_POLE2
----------- ----------------------------------- ------------ ------------
KEY_POLE
-----------------------------------
6 mk 12 5
lkjhgfd
0 n 1 1
gsgjhgf
SQL> select * from system.new_table where number_pole=1;
NUMBER_POLE STRING_POLE NUMBER_POLE2 STRING_POLE2
----------- ----------------------------------- ------------ ------------
KEY_POLE
-----------------------------------
1 a 2 5
lkj
1 b 3 7
ghjkl
SQL> spool out;
Connected.
SQL> create table new_table(
2 number_pole NUMBER(11) NOT NULL,
3 string_pole VARCHAR(35) NOT NULL,
4 number_pole2 NUMBER(11) NOT NULL,
5 string_pole2 NUMBER(35) NOT NULL,
6 key_pole VARCHAR(35) NOT NULL,
7 primary key (key_pole));
Table created.
SQL> create user new_user identified by password
2 default tablespace users
3 temporary tablespace temp
4 quota 10m on users;
User created.
SQL> GRAND CONNECT, RESOURCE, CREATE VIEW TO new_user;
SP2-0734: unknown command beginning "GRAND CONN..." - rest of line ignored.
SQL> GRANT CONNECT, RESOURCE, CREATE VIEW TO new_user;
Grant succeeded.
SQL> GRANT INSERT, UPDATE, DELETE on new_table TO new_user
2 ;
Grant succeeded.
SQL> grant select on system.new_table to new_user;
Grant succeeded.
SQL> connect new_user/password
Connected.
SQL> insert into system.new_table values(1, 'a', 2, 5, 'lkj');
1 row created.
SQL> insert into system.new_table values(1, 'b', 3, 7, 'ghjkl');
1 row created.
SQL> insert into system.new_table values(6, 'c', 8, 9, 'ghggl');
1 row created.
SQL> insert into system.new_table values(0, 'n', 1, 1, 'gsgjhgf');
1 row created.
SQL> insert into system.new_table values(6, 'mk', 12, 5, 'lkjhgfd');
1 row created.
SQL> select number_pole*13 from system.new_table;
NUMBER_POLE*13
--------------
13
13
78
0
78
SQL> select * from system.new_table order by string_pole;
NUMBER_POLE STRING_POLE NUMBER_POLE2 STRING_POLE2
----------- ----------------------------------- ------------ ------------
KEY_POLE
-----------------------------------
1 a 2 5
lkj
1 b 3 7
ghjkl
6 c 8 9
ghggl
NUMBER_POLE STRING_POLE NUMBER_POLE2 STRING_POLE2
----------- ----------------------------------- ------------ ------------
KEY_POLE
-----------------------------------
6 mk 12 5
lkjhgfd
0 n 1 1
gsgjhgf
SQL> select * from system.new_table where number_pole=1;
NUMBER_POLE STRING_POLE NUMBER_POLE2 STRING_POLE2
----------- ----------------------------------- ------------ ------------
KEY_POLE
-----------------------------------
1 a 2 5
lkj
1 b 3 7
ghjkl
SQL> spool out;