> Code Storage: table

Code Storage

A Technical blog for those who want to gain knowledge about SQL,MySQL,Data Science and real time query

Responsive Ads Here

Advertisement

Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Monday, February 17, 2020

SQL JOIN ? TYPE OF JOIN IN SQL

SQL JOIN:-

SQL join and type of join 

SQL join clause is used to combine rows from the two or more tables or joins in SQL are used to retrieve data from two or more related tables.In general tables are related to each other using foreign key constraint.

In SQL there are different types of joins
  1. Inner join
  2. Outer join 
  3. Cross join

1.Inner join:- 

                       Inner join keywords select the records that have matching in both the table. 

2.Outer join:-

                      Outer join keywords select records that does not have match in both the table.

3.Cross join:-

                      Cross join is join of tables without specifying of join condition the query would return                          all possible combination of the tables in the SQL query.

EXAMPLE:-

  • Order table
1.Order table

  • Customer Table
        

2.Customer table

         Query:-

            SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
            FROM Orders
            JOIN Customers ON Orders.CustomerID=Customers.CustomerID;

  Output:-


Thursday, January 9, 2020

Database fundamental.what is database and table and record.

Database,table,record,SQL,fundamental
                                                      1. Database fundamental,table,record


DataBase Fundamental


  • Database server instance contains multiple database.
  • Database contain multiples tables.
  • Data have two important form:
                  1. File form
                  2. Table form 

1. File Form      

  • SQL server database have three types of file:
                        a.Primary File
                        b.Secondary File
                        c. Transaction Log  

a.Primary File:-       

  • The primary data file contains the startup information for the database and point to the others file in database.
  • User data and object can be stored in this file or secondary data file.
  • Every database has one primary data file.
  • The recommended file name extension for primary data file is ".mdf ".         

b.Secondary File:-      

  • Secondary data files are optional,are user defined and store user data.
  • Secondary files can be  used  to spread data across multiple disk by putting each file on a different disk drive.
  • If a database exceeds the maximum size for a single windows file you can use secondary data files so the database can continue grow.
  • The recommended file name extension for secondary data files is ".ndf".

c.Transaction Log:-

  • The  transaction log files hold the log information that is used to recover the database.
  • There must be at least one log file for each database.
  • The recommended file name extension for transaction log is ".ldf".

2.Table Form

  • SQL table is a collection of data which is organized in terms of rows and columns.
  • In DBMS,the table as known as relation and row as a tuples.
  • Table is a simple form of  data storage.A table  is also convenient representation of relation.
  • Tables contains multiple records (Rows and Columns ).

What is Database

  • A database is a systematic collection of data .
  • Database support storage and manipulation of data.
  • Database make data management easy.

Table And Record

  • A table in a relational database is a predefined format of rows and column that define an entity.
  • Each column contains a different type of attribute and each row corresponds to a single record.
  • Each table is provided with a name.
Example:-
                    SID              Name          Address             Contact
                   1001              Shiva            Delhi                  123456
                   1002              Ram            Mumbai               987658
                   1003               Sri               Pune                   435675  --------> Record(Row)

SEVER TYPE IN SSMS ( Sql Server Managment studio)

When you install the SQL Server management studio and then you want to connect with the SQL Server then there are four types of SQL servers ...