Ads Here

Monday 8 January 2018

Oracle SQL - Get Started

After successfully completed the setup now we can run Oracle SQL commands. Now, in database we need a user to work. So, first we create a user. We can also use the default user SYSTEM & SYS but it is better to work with your own database. But, here for create a database we need system also. So, let start -
Create a database :
1) First of all you have to go to the Oracle Database home page. For that go to this location C:\oraclexe\app\oracle\product\11.2.0\server and there you find a filE called 'Get_Started', click on that file and then the Oracle database homepage will open in your default browser.
2) After that it ask you for login. Now, you enter Username 'SYSTEM' and Password that you entered on the time of installation.
3) After login go to 'Application Express' tab. There you see a form for create a database.
4) Now, type the Database Username, Application Express Username(same as database username), Password and confirm Password. After that click on Create Workspace and your database will created.
5) After the database create complete there you see a option for login to your database. Click on this and that will take you to a another page.
6) In that page you see your new created database workplace and username. Then enter your password and click on login.
Now, you have successfully created and logged in to the database.
Now, we can run Oracle SQL command to work on this database. For run SQL commands go to the Oracle Database 11g Express Edition folder in all apps and from there open two applications - 1) Run SQL Command Lines and 2) Start Database.
We write our SQL commands in the Run SQL Command Line. But, first we have to connect the Run SQL command Line with our database user. So, let's see some basic SQL commands to connect with database user.
Connect SQL command with User:
So, for connect you SQL command application with database user we have a SQL command. The command is like this -
Syntax:
The Conn Keyword is used for connect. After conn we have to put the username and password of the database and then press enter. When you press enter is will show Connected, that means your SQL command is connected to the database.
Example:

So, from the given the example you can see i am connecting with my Database which username is Learn_World and password is 123456. Similarly you also have to connect with the database you created.
Check User:
For check the user try this -
Syntax:

This SQL command will show you the user after connected. In, my case this command will show User is "LEARN_WORLD".
Disconnect from User:
After completing all work you have to disconnect from user. For that try use this -
Syntax:

When you press enter or execute this command, it will disconnect you from your database.
Clear Screen:
After running lots of command if we want to clear the screen then we can use this -
Syntax:

When you execute this command your SQL command screeen will clear.
So, this is for now, from the next article we will start the Database Definition Language(DDL). If anyone have any question ask me in the comment section, thank you.

No comments:

Post a Comment