Joins

In this lesson we are going to study about joins in a database . In order to join rows from multiple table or view we use join in our statement in this session we will briefly discussing the join and type of join in database .
JOINS:
  • Joins query are written in the where clause of the select statement.
  • Joins condition :comparing two columns of two tables.
  • Database engine joins the table according to the join condition .
  • If we want to join more then two table then database engine evaluates columns of the two tables and then it joins the result to the other table.
Have a look this image which shows the operation of the join.


Table A and Table B is having some comman columns .by giving the condition in where clause we can have the result of joined table.
NOTE: The columns which are using in join condition must have the same datatype . otherwise it will give error and to prevent this cause if having different datatype but still we want to use that columns in join condition then use the cast function to convert the datatype and then use in join condition .




Type of Joins:
 Joins are classified according to the different type way the join operation performed on the tables.

we will discuss about all this Join in details in the next section .comming soon.

I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebooktwitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends:

How To Attach mdf file in sql server

In the previous lesson we have already discuss about how to log in your database server and access your database  located in local server or remote server and all if you miss those lesson then just have a look here..

This article will assist with moving SQL Server Data File(s) (.mdf) and Log File(s) (.ldf) from one location to another using the attach and detach .but before going into step for attach and detach the mdf and ldf let talk in short about

what is mdf?
what is ldf?
what is ndf?

SQL Server databases have three types of files:

Primary data files:The primary data file is the starting point of the database and points to the other files in the database. Every database has one primary data file. The recommended file name extension for primary data files is .mdf.

Secondary data files:Secondary data files comprise all of the data files other than the primary data file. Some databases may not have any secondary data files, while others have multiple secondary data files. The recommended file name extension for secondary data files is .ndf.

Log files:Log files hold all of the log information used to recover the database. There must be at least one log file for each database, although there can be more than one. The recommended file name extension for log files is .ldf.

step to attach database file:

Step1:Just folllow the below screen and brose the attach file window.Right click on database >>all task>>attach database.


Step2:click on browse option in newer version this option named as add new  then select .mdf file and click on OK.



Step3: Now the database .mdf file is in browse window for confirmation click on OK other choss another .mdf file. After click on OK it will give message whether the file is attach or not.

step to detach database file: first select your database then give right click and select the detach option .
 step to move database file:  To move the database file there are two way first way is Stop the sql server and then go to the physical path of .mdf file copy and past it another place or in your hard disk and attach in other sql server  and remeber dont forget to start the sql server once you stop it .Second way is detach the database then copy the database and move it another location then again attach the database .mdf file.
I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebook, twitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends:

Connect to server database using TNS


  We all know most of the database are having the client server architecture i.e client send a query to retrive some data from the database and the server process all those query and in retrun the client get the data which he request for.In this section we are not going in deep of client server architecture but yes this section is all about how you can connect to database server.
Connect to sql server database
  It is very easy to connect to SQL Server2008. Start your SQL Server Managment studio and you will get the screen as shown right side .Enter server type,servername ,authentication
(select sqlserver authentication if you are connecting to other then the local computer), login name,password 
and connct to your SQL Server database.
Connect to oracle database server:
     To connect the oracle database server we need to have to TNS Configure in the client system.There are many step to create a TNS but in this section we learn how to create TNS using TOAD for Oracle (I do belive that you have successfully installed the Toad for oracle which we have already discussed in the previous section if you miss the reading last article on installation of Oracle for Toad visit here)
     
     Step1: Start your Toad for Oralce you will get the screen like below if you are not getting the below screen then get confuse go to session menu (short key alt+s) and then click on new session and you will get the below screen.
        Step2: Now click on TNSnames Editor you will be getting the below screen to create the TNS for your oracle server Easy way to create the TNS is to go into the Text Editor tab copy and past the below informantion :

Your_oracle_ServerName =
  (DESCRIPTION=
     (ADDRESS_LIST=
        (ADDRESS=
           (COMMUNITY=tcp.world)
              (PROTOCOL=TCP)
                (Host=192.153.0.1)
                (Port=1521)
                )
              )
         (CONNECT_DATA=
            (SID=orcl)
          )
     )
Note: Replace the bold red colored text with your own oracle database server.
    Step3: Click on save then click on OK.
    Step4: Go to session menu 
(short key alt+s) and then click on new session
You will get the same screen as shown here .Now enter your User/Schema name, password , name of you database and then click on connect.

NOTE: if you are getting any TNS
error then get confirm that your computer is connect to server computer.
i.e chek your LAN setting (use ping command to chek the connection,type this in command prompt  ping 127.0.0.1 -t )
I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebook, twitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends:

Step to install oracle for Toad


      Toad® for Oracle is unrivaled for ensuring the greatest possible productivity in development and administration of Oracle databases. Only Toad combines the deepest functionality available with extensive automation and intuitive workflows. With Toad, database professionals of all skill and experience levels can collaborate and work efficiently and accurately.so in this section we are steping into the installation of oracle for toad.
and for this section download the toad from here   DOWNLOAD LINK .

Step to install the toad
Step1: first download the setup for toad then run the setup.exe and then click on next
Step2: after click on next you will get the licence agreement accept the agrement and click on next .
Step3: once you accept the licence agrement  then choss which type of installtion you want  i suggest you to choss full installtaion ,mode show that it will install all the things .then if you want add on programm then chek otherwise unchek the add on. and click on next.
Step4:Now select the installtion drive you want by default will install in   c:\program file\Quest Software\Toad for Oracle .again give a click on Next
Step5:Now its ready to install click on Next and install Toad.

Step6:Installation complete successfully.
Step7:open the toad it will ask for the
Authorization Key:
Site Message:
Then click on ok. all the step installtion are completed successfully



Step8:Enter the log in details like user/schema name and password for acces the database .select the database ,and mode of conncting by the oracle database server. like TNS,Direct...
I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebook, twitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends:

Steps to open SQL*plus


Steps to open SQL*plus for the First time
In the previous lession we have discuss different tools used  for entering the sql statement In this lession we are going to discuss how to open sql* plus for the first time after succesfully instalation of oracle 10g take the following step to open the sql* plus tool to connect to the database.
step for open the sql * plus:-
 
follow the below diagram to open the sql* plus.



 once sql plus is runnig it will show the log in screen that ask three things username,password ,and host string.
in the host string we need to enter the name we have assign for tns connectivity in the file TNS.ORA .this file contain the machine name,port no,sid of the database we need to specify this when we are going to connect to server database.here we are connecting the local database that is why hightlet only the username and password field. so leave the host string blank and clicj on ok. after  successfully log in you will get the sql * plus editor for writing the sql statement .


I am interested in hearing your feedback, so that I can improve my articles and learning resources for you.connect with us on facebook, twitter

Share

Did you enjoy reading this and found it useful? If so, please share it with your friends: