Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

log4

.txt
Скачиваний:
9
Добавлен:
27.05.2017
Размер:
5.54 Кб
Скачать
SQL> connect system/password
Connected.
SQL> grant alter on new_table to user;

Grant succeeded.

SQL> connect user/password;
Connected.
SQL> select*from new_table;

ID NAME AGE
---------- ------------------------------ ----------
EMAIL
--------------------------------------------------
PASSWD FUNCTION
-------------------------------------------------- ----------
1 Vlad 23
vladislav@mail.ry
qwerty doctor

2 Masha 19
mary@mail.ru
asdfg teacher

3 Denis 20
denis@mail.ru
zxcvb engineer

4 Tanya 25
tatyana@mail.ru
12345 policeman

5 Sergey 25
sergey@mail.ru
67890 programmer

SQL> alter table new_table
2 drop column function;

Table NEW_TABLE altered.

SQL> select lower(email) from new_table;

LOWER(EMAIL)
--------------------------------------------------
vladislav@mail.ry
mary@mail.ru
denis@mail.ru
tatyana@mail.ru
sergey@mail.ru

SQL> select upper(email)from new_table;

UPPER(EMAIL)
--------------------------------------------------
VLADISLAV@MAIL.RY
MARY@MAIL.RU
DENIS@MAIL.RU
TATYANA@MAIL.RU
SERGEY@MAIL.RU

SQL> alter table new_table
2 add function varchar2(15);

Table NEW_TABLE altered.

SQL> update new_table
2 set function='doctor' where id=1;




SQL> update new_table
2 set function='teacher'
3* where id=2;



SQL> update new_table
2 set function='engineer'
3* where id=3;



SQL> update new_table
2 set function='policeman'
3* where id=4;



SQL> update new_table
2 set function='programmer'
3* where id=5;
1 row updated.

SQL> select id, function from new_table;

ID FUNCTION
---------- ---------------
1 doctor
2 teacher
3 engineer
4 policeman
5 programmer



SQL> select initcap(function) from new_table;
INITCAP(FUNCTION)
---------------
Doctor
Teacher
Engineer
Policeman
Programmer

SQL> select lpad (function,20,'*') from new_table;

LPAD(FUNCTION,20,'*')
--------------------------------------------------------------------------------
**************doctor
*************teacher
************engineer
***********policeman
**********programmer

SQL> select function from new_table where id=1;

FUNCTION
---------------
doctor

SQL> select length(function)-length(replace(function,'o')) from new_table where id=1;

LENGTH(FUNCTION)-LENGTH(REPLACE(FUNCTION,'O'))
----------------------------------------------
2


SQL> select function from new_table where id=3;
FUNCTION
---------------
engineer


SQL> select length(function)-length(replace(function,'e')) from new_table where id=3;
LENGTH(FUNCTION)-LENGTH(REPLACE(FUNCTION,'E'))
----------------------------------------------
3


SQL> select function from new_table where id=4;
FUNCTION
---------------
policeman


SQL> select length(function)-length(replace(function,'i')) from new_table where id=4;
LENGTH(FUNCTION)-LENGTH(REPLACE(FUNCTION,'I'))
----------------------------------------------
1


SQL> select length(function)-length(replace(function,'a')) from new_table;
LENGTH(FUNCTION)-LENGTH(REPLACE(FUNCTION,'A'))
----------------------------------------------
0
1
0
1
1



SQL> select to_char(sysdate, 'Dy DD-Mon-YYYY HH24:MI:SS')as "Current Time" from dual;
Current Time
------------------------------------------
Thu 15-May-2017 20:31:46


SQL> select last_day(to_date('05','mm')) from dual;
LAST_DAY(
---------
31-MAY-17

SQL> spool out;
Соседние файлы в предмете Безопасность систем баз данных