SQL REAL TIME EXAMPLES AND SCENARIOS
Ads
Thursday, May 29, 2014
Monday, March 31, 2014
Oracle 11g – How to login "scott/tiger" accounts after installment
After
I have successfully installed the Oracle 11g, I wanted to use SQL*plus.
However, when I tried to connect database as login name: sys, I found
the account is locked. Later I tried to login with "system" account,
then alter and active scott/tiger. Here are steps for these actions.
1. SQL> conn user/password;
SQL> conn sys/private password;
Error message is displayed: the account is locked.
2. Try to login as "system" - pass
SQL> conn system/password;
3. Unlock "scott"
SQL> alter user scott account unlock;
4. Can change "tiger":
SQL> alter user scott identified by tiger;
5. SQL> conn scott/tiger; -Success
Tuesday, March 25, 2014
SQL ORDER BY
The ORDER BY clause is used in a SELECT statement to sort results either
in ascending or descending order. Oracle sorts query results in
ascending order by default.
SQL> Select ename,sal, from emp where sal > 100 order by ename desc; (DESCENDING ORDER)
SQL> Select ename,sal from emp where sal > 100 order by ename (BY DEFAULT ASCENDING ORDER)
SQL> Select ename,sal,comm from emp order by 1;
(In the Above Query ORDER BY 1 is Taking Column Name from Select Option)
Ename-> Column 1.
Sal-> Column 2.
SQL> Select ename,sal, from emp where sal > 100 order by ename desc; (DESCENDING ORDER)
SQL> Select ename,sal from emp where sal > 100 order by ename (BY DEFAULT ASCENDING ORDER)
SQL> Select ename,sal,comm from emp order by 1;
(In the Above Query ORDER BY 1 is Taking Column Name from Select Option)
Ename-> Column 1.
Sal-> Column 2.
Tuesday, March 18, 2014
Subscribe to:
Posts (Atom)