microsoft sql fundamentals coursefundamentals course microsoft sql 7 knowledge tree training 2019...

13

Upload: others

Post on 17-Apr-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3
Page 2: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

Knowledge Tree Training 2019 v.18.6.1 © 2knowledgetreetraining.com

We work hard to increase the quality of our brand and strengthen our strategic partnerships. We believe if we work together with other training companies we can improve the quality of courses and offering for you, our customers.

This material is copyright of Knowledge Tree Training Ltd - © 2017. All rights reserved. You may not, except with our express written permission, distribute or commercially exploit the content. Nor may you transmit it or store it by any other means or other form of electronic retrieval system.

We start with Why?Do you know your Why? The purpose, cause, or belief that inspires you to do what you do?

Version No. Type & Date Change

Version 18.6.1 Exc. update 1-6-18 Updates for MS SQL Server 2018

Version Control

Page 3: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

knowledgetreetraining.com3 Knowledge Tree Training 2019 v.18.6.1 ©

Hello & Welcome,

You’ve come to the right place!

We’re really pleased that you’ve chosen us for your professional development course and you can be rest assured you’re in safe hands. We love what we do at Knowledge Tree and we hope that you will enjoy your time with us on this course. Our trainers are experts who love to teach, so don’t be afraid to put their knowledge to the test with a few tricky questions. I know they love a challenge.

Through our efforts and those of our trusted partners we are seeking to innovate within the professional training market. We want a clear, transparent and honest approach to professional training. We believe in well-designed courses, expert tutors and comfortable venues. We believe those are the three keys to success. We want to give you access to courses wherever you are, with particular focus on weekend and evening courses for busy professionals. We put a strong focus on our technology platforms to make your learning experience is as convenient and accessible as possible.

We are constantly developing new courses and expanding our locations across the UK. Our vision is to deliver excellent training courses in all aspects of IT & Management Training, from PRINCE2 Project Management to C# or Java technical courses. A one stop shop for all your training needs. A company you can trust, who you know will treat you fairly and takes great care with what they do.

We keep a close eye on our competitors and we do try to squeeze every last bit value out of a course for you that we can; however we will simply not sacrifice quality for cheaper prices. We know we aren’t the cheapest, we don’t try to compete on price. We aren’t simply a ‘bums on seats organisation’. The old adage is very true when it comes to choosing a training course ‘You get what you pay for’.

Enjoy it!

Christopher LamphCEO, Knowledge Tree Training

Page 4: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

Knowledge Tree Training 2019 v.18.6.1 © 4knowledgetreetraining.com

MS SQL Fundamentals Course

Page 5: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

knowledgetreetraining.com5 Knowledge Tree Training 2019 v.18.6.1 ©

Data, Data processing and Databases

Examples of Data

2

3

■ Collection of facts about an object

■ Size, weight, shape, make, colour, etc.

■ Continuous measurement of a value

■ Temperature outside, pressure in the engine, wind speed, etc.

■ Verbal description

■ Instructions, legal documents, letters to friends, invitations etc.

■ Other

■ Graphs, maps, blueprints, schematics etc.

Page 6: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

Knowledge Tree Training 2019 v.18.6.1 © 6knowledgetreetraining.com

Information

Information Extraction

■ How many books are there? ■ How much did it cost to buy them? ■ How many different titles? ■ Do we have duplicates? ■ What is the oldest book in the collection? ■ What are the countries of origin?

4

5

Raw data

Context (Scope)

Information

When data is processed, organized, structured or presented in a given context so as to make it useful, it is called information.

15.9,17.2,17.3, 16.2,18.2, 18, 18.9, 19.5, 22.8…

Minimal temperature in London in September 2017

Page 7: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

knowledgetreetraining.com7 Knowledge Tree Training 2019 v.18.6.1 ©

6Structured Data

7

8

Field #1 Field #2 Field #3 Field #n

Title Publisher Author #1 Total # of pages

Data Records

A record is a single unit of structured data.

A book record

Title Publisher Author #1 Total # of pages

Country of origin Language Year of publication

Data Records

■ The structure (schema) of our data records are determined by the information we may need to extract from the database

The context (scope) is important!

Page 8: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

knowledgetreetraining.com23 Knowledge Tree Training 2019 v.18.6.1 ©

JOIN 49

How JOIN actually works 50

Does the predicate evaluate to True?If “Yes” – take the row, if “No” - skip it.

Page 9: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

Knowledge Tree Training 2019 v.18.6.1 © 24knowledgetreetraining.com

LEFT JOIN 51

RIGHT JOIN 52

SELECT column_name(s)FROM table1LEFT [OUTER] JOIN table2ON table1.column_name=table2.column_name;

SELECT column_name(s)FROM table1RIGHT [OUTER] JOIN table2ON table1.column_name=table2.column_name;

Page 10: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

knowledgetreetraining.com25 Knowledge Tree Training 2019 v.18.6.1 ©

FULL JOIN 53

CROSS JOIN 54

SELECT column_name(s)FROM table1FULL [OUTER] JOIN table2ON table1.column_name=table2.column_name;

SELECT column_name(s)FROM table1CROSS JOIN table2

{Table1 x Table2}

Page 11: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

Knowledge Tree Training 2019 v.18.6.1 © 26knowledgetreetraining.com

Exercise #4 55

Functions 56

SQL functions 57

■ Creating foreign keys

■ Creating database diagram

■ Writing INNER JOIN queries

■ SQL functions return a value by performing an operation based on parameters passed to it - some functions require no parameters.Examples: GETDATE(), CONCAT() etc.

■ SQL aggregate functions return a single value, calculated from values in a column(s). Examples: COUNT(), SUM(), AVG()

Returns current date and time – a single value

Each result row is accompanied by an extra value for the current date and time

Page 12: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

knowledgetreetraining.com27 Knowledge Tree Training 2019 v.18.6.1 ©

SQL functions 58

SQL aggregate functions 59

Returns Harry Potter

An aggregate function is used to provide an aggregation (grouping) for a SQL statement, such as counts or totals or averages.

COUNT(ColumnName) excludes NULL values for that column

Page 13: MICROSOFT SQL FUNDAMENTALS COURSEFUNDAMENTALS COURSE MICROSOFT SQL 7 Knowledge Tree Training 2019 v.18.6.1 knowledgetreetraining.com Structured Data 6 7 8 Field #1 Field #2 Field #3

FUNDAMENTALS COURSE

MICROSOFT SQL

Knowledge Tree Training 2019 v.18.6.1 © 28knowledgetreetraining.com

SQL aggregate functions 60

GROUP BY 61

Subquery is a query which is nested inside a SELECT, INSERT, UPDATE or DELETE statement or inside another subquery.

Column ‘Books.BookTypeId’ is invalid in the select list be-cause it is not contained in either an aggregate function or the GROUP BY clause.