Sql server introduction fundamental

251 views
169 views

Published on

SELECT, ORDER BY, FROM

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
251
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Sql server introduction fundamental

  1. 1. MS SQL SERVER AND MYSQL Day 1
  2. 2. Introduction • Microsoft SQL Server is a relational database management system which stores data in tabular format that is columns and rows wise. • Components of Sql server 1. Database Engine 2. Sql Server Integration Services (SSIS) 3. Sql Server Analyses Services (SSAS) 4. Sql Server Reporting Services (SSRS)
  3. 3. Database Engine • Its task is to provide cores functionalities that is storing and retrieving the data in very efficient manner. 1. Creating database objects like table, view, stored procedure etc. 2. Retrieving, updating, inserting, deleting or merging data from different database objects. 3. Sending email notification when data is modified. 4. Perform some database scheduled jobs etc.
  4. 4. Integration Services(SSIS) • It can load the 1 TB data in 30 minutes. • Its task is to extract the data from different sources likes databases, raw files, XML etc, perform some operations (likes data cleaning, sending emails etc) and load the data into different destinations. • Download the data from FTP severs, correct the spelling, verb forms etc of data and save in the XML file.
  5. 5. Analyses Services(SSAS) • Its task is to create multi dimensional data structure of an OLAP system, analyze and aggregate the data. Also it implements various data mining models. 1. Get the detail information of sold car over last 10 years for that family which has three children. 2. Forecasting sales in coming year etc.
  6. 6. Reporting Services(SSIS) • Generate a report by getting data from different tables in PDF format. • Generate a report to display total sales in different location of a country in map view. • Generate a pie chart to display purchase volume.
  7. 7. Server Vs Client 1. What is difference between Sql Server and SSMS? 2. What is difference between MySql Server and MySql Workbench?
  8. 8. Server Vs Client
  9. 9. SELECT Statement 1. FROM 2. ON 3. JOIN 4. WHERE 5. GROUP BY 6. WITH CUBE or WITH ROLLUP 7. HAVING 8. SELECT 9. DISTINCT 10. ORDER BY 11. TOP
  10. 10. FROM Clause • [Linked_Server].[Database_Name].[Schema_Name].[Table_Name]
  11. 11. WHERE Clause • This clause filters the records from data source. • Wrongly written filter predicates(conditions) can badly decreases the query performance.
  12. 12. Does order of predicates matters in WHERE clause? • • Comparison with string is costlier than integer comparison. LIKE is itself a costly operator. • Also if first filter condition will return less result set then other filter condition has to perform less number of comparisons.
  13. 13. ORDER BY Clause • Syntax: ORDER BY <Expression> [ASC | DESC] [,…n] • What is Default sort order?
  14. 14. TOP Clause • Syntax: TOP(Expression) [PERCENT] [WITH TIES] • Only specified first set or percent rows will be returned. • It returns random rows. • MySql equivalent is LIMIT clause.
  15. 15. GROUP BY Clause Student Name Semester Mathematics Physics Scott 1 20 30 Scott 2 15 20 Scott 3 25 25 Greg 1 18 25 Greg 2 20 35 Greg 3 22 24 Note: In MySql GROUP BY clause all sort the data according group by columns.
  16. 16. Aggregate Function • • • • • • COUNT COUNT_BIG AVG MIN MAX SUM
  17. 17. HAVING Vs WHERE • Syntax: [HAVING <Search Condition>] • Having clause filters the records in the group. • Where clause filter filters the records in the table.
  18. 18. THANK YOU

×