Thursday, May 20, 2021

SQL Concept- Part 1

 

In this blog we are going to understand the important and basic concepts of SQL...


1.How to cretate a SQL Server database connection and new database?


firstly open SSMS and connect with server also ensure SQL server is in running mode.





create a new database:


                                        

create a table:


                                          


2.What is Primary key in SQL Server?

  • The PRIMARY KEY constraint uniquely identifies each record in a table.
  • Primary key always has unique data.
  • A primary key cannot have null value.
  • There can be no duplicate value for a primary key.

   

  



3.What is an identify column in SQL Server?
  
  • Identity column of a table is a column whose value increases automatically. 
  • The value in an identity column is created by the server. 
  • A user generally cannot insert a value into an identity column. 


 




4.How we can create primary key and foreign key relationship?

  • Choose the primary key of table tblCustomer and make relationship with another tablet tblAddress1.
  • To make so goto table tblAddress1 design ->right click on it->Choose an option called relationship->Click on Add We will get dialog box as below. 
  • Choose your foreign key which is primary key of another table called tblCustomer.

                                          


5.Are nulls allowed in foreign key?
    
             Yes, it can be NULL or duplicate. 

Example:

                                               

Output:


        

For more understanding watch below video :

Thank you!!!!


No comments:

Post a Comment

Function in SQL -part 8

  In this blog we are going to understand  Sql function.   FUNCTION: A function is a database object in SQL Server. It accepts only input pa...