SlideShare a Scribd company logo
1 of 2
Download to read offline
1.Difference between Constraints and Triggers

      S.No   Constraints                           Triggers

      1      Once we define some constraint in It will be stored as separate object
             a table they will be stored along
             with table definition

      2      Constraints will do memory            Triggers will do table to table
             location to table comparison.         comparison.For this triggers will use
                                                   magic tables(inserted,deleted).

      3      In the order of precedence first      In the order of precedence only after
             Constraints will be fired             Constraints is fired,then only Triggers
                                                   will be fired

      4      Performance wise Constraints will     Performance wise triggers will give
             not give best performance because     best performance because table to table
             memeory location to table             comparison is faster than memeory
             comparison is slower than table to    location to table comparison.
             table comparison.

      5      Constraints cannot start a chain      Triggers are used to carry out tasks
             reaction as like triggers - for       which cant be done using constraints.
             instance each delete, update action   For eg:-A change in the "sal" column
             etc. can trigger off another          of a table should change the "tax"
             function                              column in another table.This cant be
                                                   done using constraints.It has to be
                                                   done using triggers.Thats where the
                                                   importance of triggers lie.

      6      Constraint is used for column         Trigger is used for table

      7      Constraints are predefined            Trigger is a user defined business rule
             business rules in which all the       for which user is responasible for logic
             organisations follow this             for business rule
             constraints without any
             modification.

      8      Constraints are used to maintain      Triggers are bascically stored
             the integrity and atomicity of        procedures which automaticallly fired
             database .In other words it can be    when any insert,update or delete is
             said they are used to prevent         issued on table
             invalid data entry . the main 5
             constraints are
             NOT NULL,PRIMARY
             KEY,FOREIGN KEY,UNIQUE
             KEY and CHECK
2.Difference between Cast and Convert in SQL Server


      S.No   Cast                                Convert

      1      Cast is ANSII Standard              Convert is Specific to SQL SERVER

      2      Cast cannot be used for             Convert can be used for Formatting
             Formatting Purposes.                Purposes.For example Select convert
                                                 (varchar, datetime, 101)

      3      Cast cannot convert a datetime to   Convert can be used to convert a
             specific format                     datetime to specific format

      4      Usage of CAST:                      Usage of CONVERT:

             USE Sample                          USE Sample
             GO                                  GO
             SELECT SUBSTRING(Name, 1,           SELECT SUBSTRING(Name, 1, 30)
             30) AS ProductName, ListPrice       AS ProductName, ListPrice
             FROM Production.Product             FROM Production.Product
             WHERE CAST(ListPrice AS int)        WHERE CAST(int, ListPrice) LIKE
             LIKE '3%';                          '3%';
             GO                                  GO



3.Difference between CUBE and ROLLUP


      S.No   CUBE                                ROLLUP

      1      It is an additional switch to       It is an extension to GROUP BY
             GROUP BY clause. It can be          clause. It’s used to extract statistical
             applied to all aggregation          and summarized information from
             functions to return cross tabular   result sets. It creates groupings and
             result sets.                        then applies aggregation functions on
                                                 them.

      2      Produces all possible               Produces only some possible subtotal
             combinations of subtotals           combinations
             specified in GROUP BY clause
             and a Grand Total.


Please visit my blog @ http://onlydifferencefaqs.blogspot.in/

More Related Content

More from Umar Ali

More from Umar Ali (20)

Affiliate Networks Sites-1
Affiliate Networks Sites-1Affiliate Networks Sites-1
Affiliate Networks Sites-1
 
Technical Video Training Sites- 1
Technical Video Training Sites- 1Technical Video Training Sites- 1
Technical Video Training Sites- 1
 
US News Sites- 1
US News Sites- 1 US News Sites- 1
US News Sites- 1
 
How to create user friendly file hosting link sites
How to create user friendly file hosting link sitesHow to create user friendly file hosting link sites
How to create user friendly file hosting link sites
 
Weak hadiths in tamil
Weak hadiths in tamilWeak hadiths in tamil
Weak hadiths in tamil
 
Bulughul Maram in tamil
Bulughul Maram in tamilBulughul Maram in tamil
Bulughul Maram in tamil
 
Asp.net website usage and job trends
Asp.net website usage and job trendsAsp.net website usage and job trends
Asp.net website usage and job trends
 
Indian news sites- 1
Indian news sites- 1 Indian news sites- 1
Indian news sites- 1
 
Photo sharing sites- 1
Photo sharing sites- 1 Photo sharing sites- 1
Photo sharing sites- 1
 
File hosting search engines
File hosting search enginesFile hosting search engines
File hosting search engines
 
Ajax difference faqs compiled- 1
Ajax difference  faqs compiled- 1Ajax difference  faqs compiled- 1
Ajax difference faqs compiled- 1
 
ADO.NET difference faqs compiled- 1
ADO.NET difference  faqs compiled- 1ADO.NET difference  faqs compiled- 1
ADO.NET difference faqs compiled- 1
 
Dotnet differences compiled -1
Dotnet differences compiled -1Dotnet differences compiled -1
Dotnet differences compiled -1
 
.NET Differences List
.NET Differences List.NET Differences List
.NET Differences List
 
Difference between ajax and silverlight
Difference between ajax and silverlightDifference between ajax and silverlight
Difference between ajax and silverlight
 
Difference between is and as operators in c#
Difference between is and as operators in c#Difference between is and as operators in c#
Difference between is and as operators in c#
 
Difference between c# generics and c++ templates
Difference between c# generics and c++ templatesDifference between c# generics and c++ templates
Difference between c# generics and c++ templates
 
Var vs iEnumerable
Var vs iEnumerableVar vs iEnumerable
Var vs iEnumerable
 
Differences between get children() and getdescendants() methods
Differences between get children() and getdescendants() methodsDifferences between get children() and getdescendants() methods
Differences between get children() and getdescendants() methods
 
Ruby on rails vs asp.net mvc
Ruby on rails vs asp.net mvcRuby on rails vs asp.net mvc
Ruby on rails vs asp.net mvc
 

Recently uploaded

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Sql server difference faqs- 8

  • 1. 1.Difference between Constraints and Triggers S.No Constraints Triggers 1 Once we define some constraint in It will be stored as separate object a table they will be stored along with table definition 2 Constraints will do memory Triggers will do table to table location to table comparison. comparison.For this triggers will use magic tables(inserted,deleted). 3 In the order of precedence first In the order of precedence only after Constraints will be fired Constraints is fired,then only Triggers will be fired 4 Performance wise Constraints will Performance wise triggers will give not give best performance because best performance because table to table memeory location to table comparison is faster than memeory comparison is slower than table to location to table comparison. table comparison. 5 Constraints cannot start a chain Triggers are used to carry out tasks reaction as like triggers - for which cant be done using constraints. instance each delete, update action For eg:-A change in the "sal" column etc. can trigger off another of a table should change the "tax" function column in another table.This cant be done using constraints.It has to be done using triggers.Thats where the importance of triggers lie. 6 Constraint is used for column Trigger is used for table 7 Constraints are predefined Trigger is a user defined business rule business rules in which all the for which user is responasible for logic organisations follow this for business rule constraints without any modification. 8 Constraints are used to maintain Triggers are bascically stored the integrity and atomicity of procedures which automaticallly fired database .In other words it can be when any insert,update or delete is said they are used to prevent issued on table invalid data entry . the main 5 constraints are NOT NULL,PRIMARY KEY,FOREIGN KEY,UNIQUE KEY and CHECK
  • 2. 2.Difference between Cast and Convert in SQL Server S.No Cast Convert 1 Cast is ANSII Standard Convert is Specific to SQL SERVER 2 Cast cannot be used for Convert can be used for Formatting Formatting Purposes. Purposes.For example Select convert (varchar, datetime, 101) 3 Cast cannot convert a datetime to Convert can be used to convert a specific format datetime to specific format 4 Usage of CAST: Usage of CONVERT: USE Sample USE Sample GO GO SELECT SUBSTRING(Name, 1, SELECT SUBSTRING(Name, 1, 30) 30) AS ProductName, ListPrice AS ProductName, ListPrice FROM Production.Product FROM Production.Product WHERE CAST(ListPrice AS int) WHERE CAST(int, ListPrice) LIKE LIKE '3%'; '3%'; GO GO 3.Difference between CUBE and ROLLUP S.No CUBE ROLLUP 1 It is an additional switch to It is an extension to GROUP BY GROUP BY clause. It can be clause. It’s used to extract statistical applied to all aggregation and summarized information from functions to return cross tabular result sets. It creates groupings and result sets. then applies aggregation functions on them. 2 Produces all possible Produces only some possible subtotal combinations of subtotals combinations specified in GROUP BY clause and a Grand Total. Please visit my blog @ http://onlydifferencefaqs.blogspot.in/