Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL The relational.

Slides:



Advertisements
Similar presentations
Database Fundamentals
Advertisements

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Physical.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Self-joins,
Microsoft Enterprise Consortium Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Database Fundamentals Defining.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Create Student-Team.
BIM313 – Advanced Programming Database Operations 1.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Aggregate.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals The Data.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Data.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Evaluating.
Designing and Implementing Databases with Microsoft SQL Server 2000 Enterprise Edition MCP Exam
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL Greenhouse Database.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL Type II (Correlated)
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Introduction.
Brought to you by powerpointpros.com
PHP and SQL Server: Queries IST2101. Project Report 4 SQL Queries Due Sunday, 4/5 at 11:59pm Instructions on how to access team webspace and SQL database.
Microsoft Access Database software. What is a database? … a database is an organized collection of data. A collection of data of similar information compiled.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Using two.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals SQL Server.
Insert Presentation Title Heremm.dd.yy, City, ST SQL Reporting Services – Building the Report Kevin Ford Services Consaultant Accela, Inc.
CpSc 462/662: Database Management Systems (DBMS) (TEXNH Approach) Introduction James Wang.
Microsoft ® Office Access ® 2007 Training Build a database I: Design tables for a new Access database ICT Staff Development presents:
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Test.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals SELECT … FROM.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL Nested aggregate.
U:/msu/course/cse/103 Day 06, Slide 1 CSE students: Do not log in yet. Review Day 6 in your textbook. Think about.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Aggregating.
Views Lesson 7.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals SELECT … FROM.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Physical.
Intro to SQL Management Studio. Please Be Sure!! Make sure that your access is read only. If it isn’t, you have the potential to change data within your.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Sorting output.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Logical operators.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL In-Line Subquery.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL Equi-Join One-sided.
Order of Operations Lesson 1.3 Mr. Sparks & Mr. Beltz.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals Set Operators:
Sub. :- Mathematics Operations on numbers: Multiplication& division Std. :- 5 th Chapter no. 3.
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium SQL Fundamentals WHERE clause.
Divisibility.
1 Connecting to a Database Server. 2 We all have accounts, with a single database each, on a Microsoft SQL Server on the USF network: allman.forest.usf.edu.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 5: SQL I Rob Gleasure robgleasure.com.
Sofia, Bulgaria | 9-10 October SQL Querying Tips & Techniques Richard Campbell.
Mathematics Enrichment DAY 6. AVERAGE = add and divide by the total TOTAL STEP 1: Get rid of answer choices that do NOT show the division by the TOTAL.
1 Working with MS SQL Server Beginning ASP.NET in C# and VB Chapter 12.
SSMS SQL Server Management System. SQL Server Microsoft SQL Server is a Relational Database Management System (RDBMS) Relational Database Management System.
Patterns and Sequences Sequence: Numbers in a specific order that form a pattern are called a sequence. An example is 2, 4, 6, 8, 10 and 12. Polygon:
Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Database Fundamentals Data.
For more course tutorials visit CIS 336 All iLabs Week 1 to Week 7 Devry University CIS 336: All iLabs Week 1 to Week 7: Devry University.
Microsoft SQL Server Database & Business Intelligence Training Training/Placement/Certification Classroom/Online/Corporate Fast track/Regular/Weekend Contact.
DEVRY CIS 336 W EEK 6 G ROUP P ROJECT T ASK 4 Check this A+ tutorial guideline at
Rob Gleasure robgleasure.com
Prepared by : Moshira M. Ali CS490 Coordinator Arab Open University
Data Virtualization Tutorial… Semijoin Optimization
Database application MySQL Database and PhpMyAdmin
Subtraction by counting on
Free Braindumps - Pass Exam - Dumps4download
Using the Set Operators
Microsoft Enterprise Consortium Type I Subquery
Discrete Structures for Computer Science
43 Order of Operations  ( ) + - X.
Objective: Be able to add and subtract directed numbers.
Database Fundamentals
Access: SQL Participation Project
Creating and Managing Database Tables
43 Order of Operations  ( ) + - X.
Objective: Be able to add and subtract directed numbers.
43 Order of Operations  ( ) + - X.
Presentation transcript:

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Advanced SQL The relational data set DIVISION problem 1 Microsoft Enterprise Consortium Microsoft Enterprise Consortium: Microsoft Faculty Connection/Faculty Resource Center

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium What you’ll need … Log in to MEC for this lesson and into MSSMS (Microsoft SQL Server Management Studio). ◦Be sure to select your account ID under Database in the Object Explorer pane, similar to the example shown here. You should know the SQL covered in the SQL Fundamental series. If there is something besides the topics for this lesson that you’re not familiar with in this presentation, please review earlier lessons in the Advanced SQL presentations. 2

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium DIVISION problem The “division” problem asks the question: “Which records in data set A correspond to every record in data set B?” Example: Which students have attended all the workshops offered for skills needed in teams? 3 IDFirst Name Last Name 1003AliceAnderson 1004BillBailey 1005CarlCarson 1006DeniseDavis WkSp ID Course Name ELEffective Leadership CECommunicating Effectively ALActive Listening GOGet Organized

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Set Operators – No DIVISION Remember the set operators such as UNION, INTERSECT, SUBTRACT? There isn’t a DIVISION operator but you can still answer the question: “Which records in data set A correspond to every record in data set B?” Count the # of records in data set B then see if any record in data set A has that many links to B. There are 4 workshops. Let’s say that Alice has attended 2 workshops, Bill has attended 3, Carl has attended 1, Denise has attended 4. Therefore, Denise has attended all the workshops. 4 IDFirst Name Last Name 1003AliceAnderson 1004BillBailey 1005CarlCarson 1006DeniseDavis WkSp IDCourse Name ELEffective Leadership CECommunicating Effectively ALActive Listening GOGet Organized

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium DIVISION: Modify the S-T database We’ll modify the Students-Teams database for this lesson. Students can attend workshops that help them learn skills for working in teams. We will add a WORKSHOPS table and an ATTENDANCES table. The ATTENDANCES table stores information for each student that attends a workshop. 5 TEAMSSTUDENTS EVALUATIONSEVAL_ITEMS_SCORES EVAL_ITEMS ATTENDANCESWORKSHOPS An SQL script is provided to create these tables and insert data.

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Revised S-T database: Look at the data Before tackling a DIVISION problem, take a look at the data in the new tables. /* Show the workshops */ select * from workshops; /* Show how many records are in the attendance table. */ select count(*) from attendances; /* Show which workshops each student has attended. List a student even if he/she hasn't attended a workshop. */ select stdid as "ID", stdfname + ' ' + stdlname as "Student", wksp_name as "Workshop" from students left join attendances on stdid = attnd_stdid join workshops on attnd_wksp_ID = wksp order by stdid; 6

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium DIVISION problem – Part 1 & 2 Which students have attended all the team skills building workshops? ◦1 st : Count how many workshops there are. select count(*) from workshops; ◦2 nd : List students and the # of attendance records each one has. select stdid as "ID", stdfname, stdlname, count(*) as "Workshop Count" from students left join attendances on stdid = attnd_stdid group by stdid, stdfname, stdlname; 7

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium DIVISION problem – Part 3 Which students have attended all the team skills building workshops? ◦3 rd : Use the workshop counting query (part 1) as a subquery in the HAVING clause of the students’ attendence counting query (part 2). /* To solve the DIVISION problem, list only students who have attended as many workshops as the # of workshops there are. */ select stdid as "ID", stdfname, stdlname, count(*) as "Workshop Count" from students left join attendances on stdid = attnd_stdid group by stdid, stdfname, stdlname having count(*) = (select count(*) from workshops ); 8

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium What was covered … Division-type problems No DIVISION operator Work-around for answering a “division” question. 9

Prepared by Jennifer Kreie, New Mexico State UniversityHosted by the University of Arkansas Microsoft Enterprise Consortium Resources Microsoft Faculty Connection—Faculty Resource Center Microsoft Transact-SQL Reference AdventureWorks Sample Database 10