Stat Wk 3. Stat 342 Notes. Week 3, Page 1 / 71

Size: px
Start display at page:

Download "Stat Wk 3. Stat 342 Notes. Week 3, Page 1 / 71"

Transcription

1 Stat Wk 3 What is SQL Proc SQL 'Select' command and 'from' clause 'group by' clause 'order by' clause 'where' clause 'create table' command 'inner join' (as time permits) Stat 342 Notes. Week 3, Page 1 / 71

2 Feedback About the lab. I got some feedback that there is too much to do in the lab in one hour. To me, this is fine, because it still leaves you with a collection of programs to run for later. Stat 342 Notes. Week 3, Page 2 / 71

3 What is SQL? SQL stands for System Query Language. It is used to build and read from large central databases. Most of the login systems and profile systems you interact with online use either SQL or something derived from them. Industry jobs are asking for SQL experience by name, and it takes a short time to master. Stat 342 Notes. Week 3, Page 3 / 71

4 Stat 342 Notes. Week 3, Page 4 / 71

5 When a login is attempted, an SQL mini-program called a query, is run. (For any trustworthy site, your password is encrypted on YOUR computer first) Stat 342 Notes. Week 3, Page 5 / 71

6 Stat 342 Notes. Week 3, Page 6 / 71

7 In this query, the data table 'login' contains two variables, 'user' and 'passhash' (encrypted password). The query will only find something that matches BOTH entries. Stat 342 Notes. Week 3, Page 7 / 71

8 SQL is used software that involves both a server (large central computer) and a client (your personal computer) When the data is on a server, only parts returned (output) to the client are visible to the client. Stat 342 Notes. Week 3, Page 8 / 71

9 This is good for security, as well as scalability. An SQL database on a server could hold a dataset much larger than a typical hard drive. Also, many people can access and work with the same master copy of the data at the same time. That master copy, being on the server, can be updated live. Stat 342 Notes. Week 3, Page 9 / 71

10 SQL is also works across many different software systems, with a minimum of language-specific quirks. Stat 342 Notes. Week 3, Page 10 / 71

11 One 'native' version of it is called MySQL. Stat 342 Notes. Week 3, Page 11 / 71

12 In SAS, SQL code can be entered and used using the PROC SQL procedure, which will look at for most of this lecture. Stat 342 Notes. Week 3, Page 12 / 71

13 Stat 342 Notes. Week 3, Page 13 / 71

14 In R, SQL code can be entered through your choice of several packages. A popular one is sqldf because it allows you run queries on online or local data with very little effort. Stat 342 Notes. Week 3, Page 14 / 71

15 Ready to start this chapter in earnest? Stat 342 Notes. Week 3, Page 15 / 71

16 About PROC SQL The SQL procedure is the Base SAS implementation of Structured Query Language. PROC SQL is part of Base SAS software, and you can use it with any SAS data set (table). We won't be using PROC SQL for the more complex tasks of setting up and dealing with a server, but we will use, PROC SQL as an alternative to other SAS procedures or the DATA step. Stat 342 Notes. Week 3, Page 16 / 71

17 Why would we work with SQL at all if other PROCs and DATA steps can do most or all of these things already? 1. Sometimes it's just easier or simpler to do something in SQL than to do it another. 2. SQL code is very similar from system to system, so you could (nearly) take it and copy/paste it into MySQL or R with sqldf and get an identical result. Also, someone familiar with SQL can read your code without knowing SAS. The general form of proc sql is: Stat 342 Notes. Week 3, Page 17 / 71

18 proc sql <SAS options>; <SQL query>; Usually proc steps always end with 'run;' to tell SAS when to stop compiling and start running the code. For SQL queries, the marker to switch from compiling to running is simple ';', so proc sql uses this ending convention instead. proc sql <SAS options>; <SQL query>; Stat 342 Notes. Week 3, Page 18 / 71

19 The options that can go in this first line include 'title' and 'outobs', which set a title or the number of output rows, just as they would in proc print. 'outobs' in particular is irritating. Other versions of SQL determine the number of rows inside the query with 'limit' or 'top'. If you are copying an SQL query into SAS, these clauses (code parts) will have to be removed and translated. Stat 342 Notes. Week 3, Page 19 / 71

20 libname stat342 '/folders/myshortcut/..'; proc sql <SAS options>; <SQL query>; Also, if you are using global statements like titles, libraries, and ODS*, these are carried into proc sql just like any other procedure. However, for most cases where both SAS and SQL have a way of writing something, it's okay to write either way. Stat 342 Notes. Week 3, Page 20 / 71

21 For example, SAS allows the use of 'ge' in the place of ' >= ' for 'greater than or equal'. Usually SQL only allows ' >= ' to be used. In proc sql, either ' >= ' or ' ge ' can be used. Stat 342 Notes. Week 3, Page 21 / 71

22 So... This works, proc sql; select * from libname.datasetname where income > 10000; and so does this, proc sql; select * from libname.datasetname where income ge 10000; Stat 342 Notes. Week 3, Page 22 / 71

23 SAS and SQL work very well together. It also does some of the additional grunt work for you. For example, - When creating a table, usually an SQL query will fail to run if there is already of the table of the mentioned name. PROC SQL will do the work of deleting the old table and replacing it with the new one automatically. Stat 342 Notes. Week 3, Page 23 / 71

24 - When deleting a table, usually an SQL query will throw an error if the table isn't there. PROC SQL simply ignores it. Stat 342 Notes. Week 3, Page 24 / 71

25 About the select statement The select statement is used to get information from one or more data sets. Most of the work done in SQL uses select in some way. The simplest select query is proc sql; select * from tablename; Which selects all the variables from the dataset 'tablename'. Stat 342 Notes. Week 3, Page 25 / 71

26 We can also set the table to only return a few rows, instead of all of them. This is done with the 'outobs' setting, just like in proc print. The following will return 10 rows of every variable from the dataset 'tablename'. proc sql outobs=10; select * from tablename; Stat 342 Notes. Week 3, Page 26 / 71

27 In SQL, * works like _all_ in SAS, it chooses every variable. We can specify particular variables by putting them between 'select' and 'from'. The following... proc sql; select age, name, bees from tablename;...will give you table of every row from tablename with 3 columns, one each for 'age', 'name', and 'bees'. Stat 342 Notes. Week 3, Page 27 / 71

28 Spacing is irrelevant to the SQL compiler, so it's good practice to space the query with one clause on each line. A clause is any portion of a query using a word with a special function, such as 'from', which indicates the name of the input table. proc sql; select age, name, bees from tablename; The 'from' clause can refer to any data set in SAS, not just ones in the work library. Stat 342 Notes. Week 3, Page 28 / 71

29 Libraries are specified as <library>. <dataset>, just like other data and proc steps. libname wk03 '/folders/myshortcut/wk03'; proc sql; select age, name, bees from wk03.tablename; You can rename variables when you select them with <input varname> as <output varname> Stat 342 Notes. Week 3, Page 29 / 71

30 . This is useful if the original name isn't descriptive enough, or a name is used multiple times in different tables. proc sql; select age as years, name, bees as buzzers from wk03.tablename; You can also run simple functions on variables, and name the result something. Simple functions include mean() Stat 342 Notes. Week 3, Page 30 / 71 Get the average of this variable

31 count() Get the number of rows of this var. first() Value of first row sum() Get the number of rows round() Rounds each value ucase() Converts any letters to upper case Stat 342 Notes. Week 3, Page 31 / 71

32 Figure out what this code does proc sql; select age, lcase(name) as Name, count(name) as N, from wk03.tablename; Stat 342 Notes. Week 3, Page 32 / 71

33 Figure out what this code does proc sql; select age, lcase(name) as Name, count(name) as N, from wk03.tablename; Stat 342 Notes. Week 3, Page 33 / 71

34 Hope this isn't too fuzzy for you. Stat 342 Notes. Week 3, Page 34 / 71

35 The 'group by' clause 'group by' is a clause you can include in a SAS query to tell it that any aggregation done should output one row for each unique value of the grouping variable. Without it, aggregation will be done on everything that's selected. Usually when aggregating a variable with mean(), count(), or max(), it not just the average, count, or largest value of all the values that you're interested in. Stat 342 Notes. Week 3, Page 35 / 71

36 If you had a data set of sales at a store, you could be interested in: - The total value of sales in each department. - The most expensive item sold each day. - The number of sales made each day. - The number of each product that was sold all year. Stat 342 Notes. Week 3, Page 36 / 71

37 The total value of sales in each department. proc sql; select dept, sum(price) as total from salesdata group by dept; Here, the variable 'total' will have sum of the values in 'price' for each of the departments. Stat 342 Notes. Week 3, Page 37 / 71

38 - The most expensive item sold each day. - The number of sales made each day. proc sql; select day, max(price) as biggest, count(price) as Nsales from salesdata group by day; Stat 342 Notes. Week 3, Page 38 / 71

39 - The number of each product that was sold all year. proc sql; select productid, count(productid) as Nsales from salesdata group by productid; Stat 342 Notes. Week 3, Page 39 / 71

40 More than one variable can be used as grouping variable. If this is done, aggregation will be done on every unique COMBINATION of those variables. The following would give the total sales made in each department for each day. proc sql; select day, dept, sum(price) as total from salesdata Stat 342 Notes. Week 3, Page 40 / 71

41 group by day, dept; One more point: The 'outobs' setting refers to the table that is OUTPUT. It does not affect the table that is being used to aggregate data. This table will aggregate information from thousands of sales, but it will show the first 10 day-dept combinations. proc sql outobs=10; select day, dept, sum(price) as total from salesdata Stat 342 Notes. Week 3, Page 41 / 71

42 group by day, dept; Stat 342 Notes. Week 3, Page 42 / 71

43 Don't be afraid to axolotl questions The 'order by' clause The rows that come out of an SQL query can be very disordered. If you are accessing data from a server composed of multiple computers or hard drives, you may even end up with the rows of your data in a different order each time you request it. The 'order by' clause makes those rows more consistent by dictating which ones should appear on the top. Stat 342 Notes. Week 3, Page 43 / 71

44 The syntax for the 'order by' clause is order by <varname> <asc/desc> for one variable, and order by <var1> <asc/desc>, <var2> <asc desc> Stat 342 Notes. Week 3, Page 44 / 71

45 for two variables. Three or more variables works the same way: variable name, then asc or desc, then a comma. If the ordering variable is numeric, the option 'desc' will put the rows in order of highest to lowest value of that number (desc stands for 'descending order'). 'asc' will order them from lowest to highest (ascending order). If the ordering variable is text, then ordering will be done alphabetically. (asc is A-Z, desc is Z-A) Stat 342 Notes. Week 3, Page 45 / 71

46 If the ordering variable is time based, like a date, then the ordering will be done in chronological order. (asc is earliest first, desc is latest first) More than one variable can be used as an ordering variable. The order of the first variable counts as more important than that of the second. In other words, the second one is a 'tiebreaker' for the first one. Stat 342 Notes. Week 3, Page 46 / 71

47 If there are still ties after all the ordering variables are used, the order of rows for ties is unpredictable. If a local dataset is the 'from' dataset, the order within ties will probably be the order of the rows of that 'from' dataset. Here, the countries will be arranged by immunity rates in 2000, starting with the highest rate. There are several countries with a 99% immunization rate in the year 2000, so among those the immunization rate in 1995 is used. Any country with a 98% immunization rate in 2000 will show up AFTER any country with a 99% rate in 2000, regardless of 1995 rates. Stat 342 Notes. Week 3, Page 47 / 71

48 proc sql; select Country, Y1995, Y2000 from wk03immunity order by Y2000 desc, Y1995 desc; The 'where' clause The 'where' clause is used to subset the data being used. Only rows that satisfy the 'where' criteria are returned (or processed by grouping). In R, the closest analogue is the which() command. Stat 342 Notes. Week 3, Page 48 / 71

49 In SAS, the closest analogue is if-then statements in the data set. The following SQL procedure would return the row entry of every person older than 25. proc sql; select age, name, bees from tablename where age > 25; Stat 342 Notes. Week 3, Page 49 / 71

50 More than one condition can be used, but the conditions have to be separated by boolean operators 'and', 'not' and 'or'. proc sql; select age, name, bees from tablename where age > 25 and age < 35; Here, two conditions are being placed on the same variable. Stat 342 Notes. Week 3, Page 50 / 71

51 More than one variable can be used. The 'where' conditions only need to refer to variables in the table (or tables) being input. They don't even have to be the variables being selected. proc sql; select age, name, bees from tablename where age > 25 or dogs > 3; Stat 342 Notes. Week 3, Page 51 / 71

52 Try to interpret this one! proc sql; select age, name, bees from tablename where age > 25 and name is not 'Thor'; Stat 342 Notes. Week 3, Page 52 / 71

53 Criteria from the 'where' clause is applied before aggregation. So any functions and 'group by' code is only run on rows of the table that are part of the 'where' subset. The following would only total the revenue from sales that were more than $5.00 per item. proc sql; select day, dept, sum(price) as total from salesdata where price > 5.00 group by day, dept; Stat 342 Notes. Week 3, Page 53 / 71

54 Another Example problem - Interpret this: proc sql; title 'Population of...'; select Continent, sum(population) as TotPop from sql.countries where Population gt group by Continent order by TotPop; Notice also that the several clauses in this sql query appear in a fixed order. This order cannot be changed. Stat 342 Notes. Week 3, Page 54 / 71

55 proc sql <options like outobs>; title <title>; select <variables, aggregation, names> from <data set> where <condition> group by <vars> order by <vars>; Stat 342 Notes. Week 3, Page 55 / 71

56 This is also the order computation is done. The title and variable names are decided, then the data set is determined, then the conditions on the data set, then aggregation, and finally sorting the output. Stat 342 Notes. Week 3, Page 56 / 71

57 Let's get creative! Stat 342 Notes. Week 3, Page 57 / 71

58 The 'create table' command 'create table' is not a part of the select command at all, but a completely separate command. It can used before a 'select' query to tell SAS to make a new dataset with the output from the select command, rather than outputting it to a table. Stat 342 Notes. Week 3, Page 58 / 71

59 Note that all the output of 'select' is a table, even if that table only includes a single value of a single row. The syntax for the create table command is proc sql; create table <new table name> as <select query>; Stat 342 Notes. Week 3, Page 59 / 71

60 'create table' is placed at the beginning of the query, right after 'proc sql;', which is used to tell SAS that a query is approching. The 'select query' would be output as a table, but instead is it saved as a SAS dataset (or an SQL table in other platforms). The following code takes our aggregation of sales by day and department and makes it a data set we can review directly. Stat 342 Notes. Week 3, Page 60 / 71

61 proc sql; create table sales_summary as select day, dept, sum(price) as total from salesdata group by day, dept;...that new aggregation data set can be read more quickly than the raw sales data. It DOES have to be updated with any new information that is used in the original data table. Stat 342 Notes. Week 3, Page 61 / 71

62 If a new day of sales is added to 'salesdata', it will not show up in 'sales_summary' automatically. Stat 342 Notes. Week 3, Page 62 / 71

63 Here we would observe only the summaries in Note the date format. proc sql; select * from sales_summary where day > ; Creating a new table not only allows you to save your work in a permanent location, but it can also make more complicated Stat 342 Notes. Week 3, Page 63 / 71

64 analyses much easier, such as inner joins between three or more datasets. Inner Joins! Inner joins are the most popular of several ways to combine two or more datasets. If someone refers simply to a 'join', it is usually an inner join. Stat 342 Notes. Week 3, Page 64 / 71

65 A select statement with an inner join takes variables from both datasets and matches them up according to some variable in comment, such as userid or date. Let Key1 the joining varaible. Stat 342 Notes. Week 3, Page 65 / 71

66 Stat 342 Notes. Week 3, Page 66 / 71

67 An inner join makes a new dataset with one row for each matched variable value and the chosen variables from each. Stat 342 Notes. Week 3, Page 67 / 71

68 With an inner join, only 1 row is created for each instance where a value from the first join variable matches a value from second join. There are other kinds of joins, such as left join, right join, and outer join. For an outer join, every COMBINATION that is one value from table 1 and one value from table B. In the case of Stat 342 Notes. Week 3, Page 68 / 71

69 having N ID values, we could end with N2 combinations of ID values. A select statement with an inner join has syntax like this: select <dataset 1>.<variable>,...<dataset 2>.<variable> from <dataset 1> inner join <dataset 2> on <condition that matches the two datasets together>; Stat 342 Notes. Week 3, Page 69 / 71

70 The most common condition used here is dataset1.variable = dataset2.variable In the following code, the Y2000 variable from each of two different data sets, teen fertility and school years. The joining variable found in both datasets is 'country'. proc sql; select wk03teenfertility.country, wk03teenfertility.y2000 as fertility2000, wk03schoolyears.y2000 as school2000 Stat 342 Notes. Week 3, Page 70 / 71

71 from wk03teenfertility inner join wk03schoolyears on wk03teenfertility.country = wk03schoolyears.country; Stat 342 Notes. Week 3, Page 71 / 71

David Beam, Systems Seminar Consultants, Inc., Madison, WI

David Beam, Systems Seminar Consultants, Inc., Madison, WI Paper 150-26 INTRODUCTION TO PROC SQL David Beam, Systems Seminar Consultants, Inc., Madison, WI ABSTRACT PROC SQL is a powerful Base SAS Procedure that combines the functionality of DATA and PROC steps

More information

CSC Web Programming. Introduction to SQL

CSC Web Programming. Introduction to SQL CSC 242 - Web Programming Introduction to SQL SQL Statements Data Definition Language CREATE ALTER DROP Data Manipulation Language INSERT UPDATE DELETE Data Query Language SELECT SQL statements end with

More information

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language

Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations. SQL: Structured Query Language Implementing Table Operations Using Structured Query Language (SQL) Using Multiple Operations Show Only certain columns and rows from the join of Table A with Table B The implementation of table operations

More information

Ten Great Reasons to Learn SAS Software's SQL Procedure

Ten Great Reasons to Learn SAS Software's SQL Procedure Ten Great Reasons to Learn SAS Software's SQL Procedure Kirk Paul Lafler, Software Intelligence Corporation ABSTRACT The SQL Procedure has so many great features for both end-users and programmers. It's

More information

NCSS: Databases and SQL

NCSS: Databases and SQL NCSS: Databases and SQL Tim Dawborn Lecture 1, January, 2016 Motivation SQLite SELECT WHERE JOIN Tips 2 Outline 1 Motivation 2 SQLite 3 Searching for Data 4 Filtering Results 5 Joining multiple tables

More information

Instructor: Craig Duckett. Lecture 03: Tuesday, April 3, 2018 SQL Sorting, Aggregates and Joining Tables

Instructor: Craig Duckett. Lecture 03: Tuesday, April 3, 2018 SQL Sorting, Aggregates and Joining Tables Instructor: Craig Duckett Lecture 03: Tuesday, April 3, 2018 SQL Sorting, Aggregates and Joining Tables 1 Assignment 1 is due LECTURE 5, Tuesday, April 10 th, 2018 in StudentTracker by MIDNIGHT MID-TERM

More information

Introduction to SQL Server 2005/2008 and Transact SQL

Introduction to SQL Server 2005/2008 and Transact SQL Introduction to SQL Server 2005/2008 and Transact SQL Week 2 TRANSACT SQL CRUD Create, Read, Update, and Delete Steve Stedman - Instructor Steve@SteveStedman.com Homework Review Review of homework from

More information

Introduction to PROC SQL

Introduction to PROC SQL Introduction to PROC SQL Steven First, Systems Seminar Consultants, Madison, WI ABSTRACT PROC SQL is a powerful Base SAS Procedure that combines the functionality of DATA and PROC steps into a single step.

More information

Lesson 2. Data Manipulation Language

Lesson 2. Data Manipulation Language Lesson 2 Data Manipulation Language IN THIS LESSON YOU WILL LEARN To add data to the database. To remove data. To update existing data. To retrieve the information from the database that fulfil the stablished

More information

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL)

Database Systems: Design, Implementation, and Management Tenth Edition. Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management Tenth Edition Chapter 7 Introduction to Structured Query Language (SQL) Objectives In this chapter, students will learn: The basic commands and

More information

GEO 425: SPRING 2012 LAB 9: Introduction to Postgresql and SQL

GEO 425: SPRING 2012 LAB 9: Introduction to Postgresql and SQL GEO 425: SPRING 2012 LAB 9: Introduction to Postgresql and SQL Objectives: This lab is designed to introduce you to Postgresql, a powerful database management system. This exercise covers: 1. Starting

More information

MIS2502: Data Analytics SQL Getting Information Out of a Database. Jing Gong

MIS2502: Data Analytics SQL Getting Information Out of a Database. Jing Gong MIS2502: Data Analytics SQL Getting Information Out of a Database Jing Gong gong@temple.edu http://community.mis.temple.edu/gong The relational database Core of Online Transaction Processing (OLTP) A series

More information

Logical Operators and aggregation

Logical Operators and aggregation SQL Logical Operators and aggregation Chapter 3.2 V3.0 Copyright @ Napier University Dr Gordon Russell Logical Operators Combining rules in a single WHERE clause would be useful AND and OR allow us to

More information

tablename ORDER BY column ASC tablename ORDER BY column DESC sortingorder, } The WHERE and ORDER BY clauses can be combined in one

tablename ORDER BY column ASC tablename ORDER BY column DESC sortingorder, } The WHERE and ORDER BY clauses can be combined in one } The result of a query can be sorted in ascending or descending order using the optional ORDER BY clause. The simplest form of an ORDER BY clause is SELECT columnname1, columnname2, FROM tablename ORDER

More information

MIS2502: Data Analytics SQL Getting Information Out of a Database Part 1: Basic Queries

MIS2502: Data Analytics SQL Getting Information Out of a Database Part 1: Basic Queries MIS2502: Data Analytics SQL Getting Information Out of a Database Part 1: Basic Queries JaeHwuen Jung jaejung@temple.edu http://community.mis.temple.edu/jaejung Where we are Now we re here Data entry Transactional

More information

INTERMEDIATE SQL GOING BEYOND THE SELECT. Created by Brian Duffey

INTERMEDIATE SQL GOING BEYOND THE SELECT. Created by Brian Duffey INTERMEDIATE SQL GOING BEYOND THE SELECT Created by Brian Duffey WHO I AM Brian Duffey 3 years consultant at michaels, ross, and cole 9+ years SQL user What have I used SQL for? ROADMAP Introduction 1.

More information

STOP DROWNING IN DATA. START MAKING SENSE! An Introduction To SQLite Databases. (Data for this tutorial at

STOP DROWNING IN DATA. START MAKING SENSE! An Introduction To SQLite Databases. (Data for this tutorial at STOP DROWNING IN DATA. START MAKING SENSE! Or An Introduction To SQLite Databases (Data for this tutorial at www.peteraldhous.com/data) You may have previously used spreadsheets to organize and analyze

More information

SQL CHEAT SHEET. created by Tomi Mester

SQL CHEAT SHEET. created by Tomi Mester SQL CHEAT SHEET created by Tomi Mester I originally created this cheat sheet for my SQL course and workshop participants.* But I have decided to open-source it and make it available for everyone who wants

More information

II (The Sequel) We will use the following database as an example throughout this lab, found in students.db.

II (The Sequel) We will use the following database as an example throughout this lab, found in students.db. 2 SQL II (The Sequel) Lab Objective: Since SQL databases contain multiple tables, retrieving information about the data can be complicated. In this lab we discuss joins, grouping, and other advanced SQL

More information

SQL Data Query Language

SQL Data Query Language SQL Data Query Language André Restivo 1 / 68 Index Introduction Selecting Data Choosing Columns Filtering Rows Set Operators Joining Tables Aggregating Data Sorting Rows Limiting Data Text Operators Nested

More information

ASSIGNMENT NO Computer System with Open Source Operating System. 2. Mysql

ASSIGNMENT NO Computer System with Open Source Operating System. 2. Mysql ASSIGNMENT NO. 3 Title: Design at least 10 SQL queries for suitable database application using SQL DML statements: Insert, Select, Update, Delete with operators, functions, and set operator. Requirements:

More information

Learn SQL by Calculating Customer Lifetime Value

Learn SQL by Calculating Customer Lifetime Value Learn SQL Learn SQL by Calculating Customer Lifetime Value Setup, Counting and Filtering 1 Learn SQL CONTENTS Getting Started Scenario Setup Sorting with ORDER BY FilteringwithWHERE FilteringandSorting

More information

Advanced Multidimensional Reporting

Advanced Multidimensional Reporting Guideline Advanced Multidimensional Reporting Product(s): IBM Cognos 8 Report Studio Area of Interest: Report Design Advanced Multidimensional Reporting 2 Copyright Copyright 2008 Cognos ULC (formerly

More information

1. Managing Information in Table

1. Managing Information in Table 1. Managing Information in Table Spreadsheets are great for making lists (such as phone lists, client lists). The researchers discovered that not only was list management the number one spreadsheet activity,

More information

Use mail merge to create and print letters and other documents

Use mail merge to create and print letters and other documents Use mail merge to create and print letters and other documents Contents Use mail merge to create and print letters and other documents... 1 Set up the main document... 1 Connect the document to a data

More information

SQL functions fit into two broad categories: Data definition language Data manipulation language

SQL functions fit into two broad categories: Data definition language Data manipulation language Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition Chapter 7 Beginning Structured Query Language (SQL) MDM NUR RAZIA BINTI MOHD SURADI 019-3932846 razia@unisel.edu.my

More information

In This Lecture. Yet More SQL SELECT ORDER BY. SQL SELECT Overview. ORDER BY Example. ORDER BY Example. Yet more SQL

In This Lecture. Yet More SQL SELECT ORDER BY. SQL SELECT Overview. ORDER BY Example. ORDER BY Example. Yet more SQL In This Lecture Yet More SQL Database Systems Lecture 9 Natasha Alechina Yet more SQL ORDER BY Aggregate functions and HAVING etc. For more information Connoly and Begg Chapter 5 Ullman and Widom Chapter

More information

Database Management Systems by Hanh Pham GOALS

Database Management Systems by Hanh Pham GOALS PROJECT Note # 02: Database Management Systems by Hanh Pham GOALS Most databases in the world are SQL-based DBMS. Using data and managing DBMS efficiently and effectively can help companies save a lot

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE

TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE TOP 10 (OR MORE) WAYS TO OPTIMIZE YOUR SAS CODE Handy Tips for the Savvy Programmer SAS PROGRAMMING BEST PRACTICES Create Readable Code Basic Coding Recommendations» Efficiently choosing data for processing»

More information

--NOTE: We are now using a different database. USE AdventureWorks2012;

--NOTE: We are now using a different database. USE AdventureWorks2012; --* BUSIT 103 Assignment #6 DUE DATE : Consult course calendar /* Name: Christopher Singleton Class: BUSIT103 - Online Instructor: Art Lovestedt Date: 11/01/2014 */ --You are to develop SQL statements

More information

COMP 244 DATABASE CONCEPTS & APPLICATIONS

COMP 244 DATABASE CONCEPTS & APPLICATIONS COMP 244 DATABASE CONCEPTS & APPLICATIONS Querying Relational Data 1 Querying Relational Data A query is a question about the data and the answer is a new relation containing the result. SQL is the most

More information

Jarek Szlichta

Jarek Szlichta Jarek Szlichta http://data.science.uoit.ca/ SQL is a standard language for accessing and manipulating databases What is SQL? SQL stands for Structured Query Language SQL lets you gain access and control

More information

An SQL Tutorial Some Random Tips

An SQL Tutorial Some Random Tips An SQL Tutorial Some Random Tips Presented by Jens Dahl Mikkelsen SAS Institute A/S Author: Paul Kent SAS Institute Inc, Cary, NC. Short Stories Towards a Better UNION Outer Joins. More than two too. Logical

More information

SAS Studio: A New Way to Program in SAS

SAS Studio: A New Way to Program in SAS SAS Studio: A New Way to Program in SAS Lora D Delwiche, Winters, CA Susan J Slaughter, Avocet Solutions, Davis, CA ABSTRACT SAS Studio is an important new interface for SAS, designed for both traditional

More information

Teradata. This was compiled in order to describe Teradata and provide a brief overview of common capabilities and queries.

Teradata. This was compiled in order to describe Teradata and provide a brief overview of common capabilities and queries. Teradata This was compiled in order to describe Teradata and provide a brief overview of common capabilities and queries. What is it? Teradata is a powerful Big Data tool that can be used in order to quickly

More information

HKTA TANG HIN MEMORIAL SECONDARY SCHOOL SECONDARY 3 COMPUTER LITERACY. Name: ( ) Class: Date: Databases and Microsoft Access

HKTA TANG HIN MEMORIAL SECONDARY SCHOOL SECONDARY 3 COMPUTER LITERACY. Name: ( ) Class: Date: Databases and Microsoft Access Databases and Microsoft Access Introduction to Databases A well-designed database enables huge data storage and efficient data retrieval. Term Database Table Record Field Primary key Index Meaning A organized

More information

INTRODUCTION TO PROC SQL JEFF SIMPSON SYSTEMS ENGINEER

INTRODUCTION TO PROC SQL JEFF SIMPSON SYSTEMS ENGINEER INTRODUCTION TO PROC SQL JEFF SIMPSON SYSTEMS ENGINEER THE SQL PROCEDURE The SQL procedure: enables the use of SQL in SAS is part of Base SAS software follows American National Standards Institute (ANSI)

More information

Databases II: Microsoft Access

Databases II: Microsoft Access Recapitulation Databases II: Microsoft Access CS111, 2016 A database is a collection of data that is systematically organized, so as to allow efficient addition, modification, removal and retrieval. A

More information

Advisor Answers. Create Cross-tabs. July, Visual FoxPro 9/8/7

Advisor Answers. Create Cross-tabs. July, Visual FoxPro 9/8/7 July, 2006 Advisor Answers Create Cross-tabs Visual FoxPro 9/8/7 Q: I have a database that stores sales data. The details table contains one record for each sale of each item. Now I want to create a report

More information

Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke

Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke Link full download: https://testbankservice.com/download/test-bank-fordatabase-processing-fundamentals-design-and-implementation-13th-edition-bykroenke

More information

3. Getting data out: database queries. Querying

3. Getting data out: database queries. Querying 3. Getting data out: database queries Querying... 1 Queries and use cases... 2 The GCUTours database tables... 3 Project operations... 6 Select operations... 8 Date formats in queries... 11 Aggregates...

More information

1. Managing Information in Table

1. Managing Information in Table 1. Managing Information in Table Spreadsheets are great for making lists (such as phone lists, client lists). The researchers discovered that not only was list management the number one spreadsheet activity,

More information

Data Manipulation Language (DML)

Data Manipulation Language (DML) In the name of Allah Islamic University of Gaza Faculty of Engineering Computer Engineering Department ECOM 4113 DataBase Lab Lab # 3 Data Manipulation Language (DML) El-masry 2013 Objective To be familiar

More information

NESTED QUERIES AND AGGREGATION CHAPTER 5 (6/E) CHAPTER 8 (5/E)

NESTED QUERIES AND AGGREGATION CHAPTER 5 (6/E) CHAPTER 8 (5/E) 1 NESTED QUERIES AND AGGREGATION CHAPTER 5 (6/E) CHAPTER 8 (5/E) 2 LECTURE OUTLINE More Complex SQL Retrieval Queries Self-Joins Renaming Attributes and Results Grouping, Aggregation, and Group Filtering

More information

Some Basic Aggregate Functions FUNCTION OUTPUT The number of rows containing non-null values The maximum attribute value encountered in a given column

Some Basic Aggregate Functions FUNCTION OUTPUT The number of rows containing non-null values The maximum attribute value encountered in a given column SQL Functions Aggregate Functions Some Basic Aggregate Functions OUTPUT COUNT() The number of rows containing non-null values MIN() The minimum attribute value encountered in a given column MAX() The maximum

More information

Chapter 6: Modifying and Combining Data Sets

Chapter 6: Modifying and Combining Data Sets Chapter 6: Modifying and Combining Data Sets The SET statement is a powerful statement in the DATA step. Its main use is to read in a previously created SAS data set which can be modified and saved as

More information

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel

Chapter 7. Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel Chapter 7 Introduction to Structured Query Language (SQL) Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel 1 In this chapter, you will learn: The basic commands

More information

10 The First Steps 4 Chapter 2

10 The First Steps 4 Chapter 2 9 CHAPTER 2 Examples The First Steps 10 Invoking the Query Window 11 Changing Your Profile 11 ing a Table 13 ing Columns 14 Alias Names and Labels 14 Column Format 16 Creating a WHERE Expression 17 Available

More information

SQL Interview Questions

SQL Interview Questions SQL Interview Questions SQL stands for Structured Query Language. It is used as a programming language for querying Relational Database Management Systems. In this tutorial, we shall go through the basic

More information

Chapter-14 SQL COMMANDS

Chapter-14 SQL COMMANDS Chapter-14 SQL COMMANDS What is SQL? Structured Query Language and it helps to make practice on SQL commands which provides immediate results. SQL is Structured Query Language, which is a computer language

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Lectures 4 and 5: Aggregates in SQL Dan Suciu - CSE 344, Winter 2012 1 Announcements Homework 1 is due tonight! Quiz 1 due Saturday Homework 2 is posted (due next

More information

Chapter # 7 Introduction to Structured Query Language (SQL) Part II

Chapter # 7 Introduction to Structured Query Language (SQL) Part II Chapter # 7 Introduction to Structured Query Language (SQL) Part II Updating Table Rows UPDATE Modify data in a table Basic Syntax: UPDATE tablename SET columnname = expression [, columnname = expression]

More information

Relational Database Management Systems for Epidemiologists: SQL Part II

Relational Database Management Systems for Epidemiologists: SQL Part II Relational Database Management Systems for Epidemiologists: SQL Part II Outline Summarizing and Grouping Data Retrieving Data from Multiple Tables using JOINS Summary of Aggregate Functions Function MIN

More information

Alyssa Grieco. Data Wrangling Final Project Report Fall 2016 Dangerous Dogs and Off-leash Areas in Austin Housing Market Zip Codes.

Alyssa Grieco. Data Wrangling Final Project Report Fall 2016 Dangerous Dogs and Off-leash Areas in Austin Housing Market Zip Codes. Alyssa Grieco Data Wrangling Final Project Report Fall 2016 Dangerous Dogs and Off-leash Areas in Austin Housing Market Zip Codes Workflow Datasets Data was taken from three sources on data.austintexas.gov.

More information

An Introduction to PROC SQL. David Beam Systems Seminar Consultants, Inc. - Madison, WI

An Introduction to PROC SQL. David Beam Systems Seminar Consultants, Inc. - Madison, WI An Introduction to PROC SQL David Beam Systems Seminar Consultants, Inc. - Madison, WI Abstract PROC SQL is a powerful Base SAS PROC which combines the functionality of the DATA and PROC Steps into a single

More information

SIT772 Database and Information Retrieval WEEK 6. RELATIONAL ALGEBRAS. The foundation of good database design

SIT772 Database and Information Retrieval WEEK 6. RELATIONAL ALGEBRAS. The foundation of good database design SIT772 Database and Information Retrieval WEEK 6. RELATIONAL ALGEBRAS The foundation of good database design Outline 1. Relational Algebra 2. Join 3. Updating/ Copy Table or Parts of Rows 4. Views (Virtual

More information

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)

MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 6 Professional Program: Data Administration and Management MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) AGENDA

More information

UAccess ANALYTICS. Fundamentals of Reporting. updated v.1.00

UAccess ANALYTICS. Fundamentals of Reporting. updated v.1.00 UAccess ANALYTICS Arizona Board of Regents, 2010 THE UNIVERSITY OF ARIZONA updated 07.01.2010 v.1.00 For information and permission to use our PDF manuals, please contact uitsworkshopteam@listserv.com

More information

CS 200. Lecture 09 FileMaker vs SQL & Reports. FileMaker vs SQL + Reports. CS 200 Spring 2018

CS 200. Lecture 09 FileMaker vs SQL & Reports. FileMaker vs SQL + Reports. CS 200 Spring 2018 CS 200 Lecture 09 FileMaker vs SQL & Reports 1 Miscellaneous Notes Abbreviations aka also known as DBMS DataBase Management System mutatis mutantis with the necessary changes having been made 2 Please

More information

Follow these steps to get started: o Launch MS Access from your start menu. The MS Access startup panel is displayed:

Follow these steps to get started: o Launch MS Access from your start menu. The MS Access startup panel is displayed: Forms-based Database Queries The topic presents a summary of Chapter 3 in the textbook, which covers using Microsoft Access to manage and query an Access database. The screenshots in this topic are from

More information

Table Joins and Indexes in SQL

Table Joins and Indexes in SQL Table Joins and Indexes in SQL Based on CBSE Curriculum Class -11 By- Neha Tyagi PGT CS KV 5 Jaipur II Shift Jaipur Region Neha Tyagi, PGT CS II Shift Jaipur Introduction Sometimes we need an information

More information

WEEK 3 TERADATA EXERCISES GUIDE

WEEK 3 TERADATA EXERCISES GUIDE WEEK 3 TERADATA EXERCISES GUIDE The Teradata exercises for this week assume that you have completed all of the MySQL exercises, and know how to use GROUP BY, HAVING, and JOIN clauses. The quiz for this

More information

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin http://www.php-editors.com/articles/sql_phpmyadmin.php 1 of 8 Members Login User Name: Article: Learning SQL using phpmyadmin Password: Remember Me? register now! Main Menu PHP Tools PHP Help Request PHP

More information

Why Relational Databases? Relational databases allow for the storage and analysis of large amounts of data.

Why Relational Databases? Relational databases allow for the storage and analysis of large amounts of data. DATA 301 Introduction to Data Analytics Relational Databases Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca DATA 301: Data Analytics (2) Why Relational Databases? Relational

More information

SQL 2 (The SQL Sequel)

SQL 2 (The SQL Sequel) Lab 5 SQL 2 (The SQL Sequel) Lab Objective: Learn more of the advanced and specialized features of SQL. Database Normalization Normalizing a database is the process of organizing tables and columns to

More information

Querying Data with Transact SQL

Querying Data with Transact SQL Course 20761A: Querying Data with Transact SQL Course details Course Outline Module 1: Introduction to Microsoft SQL Server 2016 This module introduces SQL Server, the versions of SQL Server, including

More information

How to Improve Your Campaign Conversion Rates

How to Improve Your  Campaign Conversion Rates How to Improve Your Email Campaign Conversion Rates Chris Williams Author of 7 Figure Business Models How to Exponentially Increase Conversion Rates I'm going to teach you my system for optimizing an email

More information

SQL: Data Querying. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 4

SQL: Data Querying. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 4 B0B36DBS, BD6B36DBS: Database Systems h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 4 SQL: Data Querying Mar n Svoboda mar n.svoboda@fel.cvut.cz 20. 3. 2018 Czech Technical University

More information

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement GIFT Department of Computing Science [Spring 2013] CS-217: Database Systems Lab-2 Manual Data Selection and Filtering using the SELECT Statement V1.0 4/12/2016 Introduction to Lab-2 This lab reinforces

More information

30. Structured Query Language (SQL)

30. Structured Query Language (SQL) 30. Structured Query Language (SQL) Java Fall 2009 Instructor: Dr. Masoud Yaghini Outline SQL query keywords Basic SELECT Query WHERE Clause ORDER BY Clause INNER JOIN Clause INSERT Statement UPDATE Statement

More information

SQL Queries. COSC 304 Introduction to Database Systems SQL. Example Relations. SQL and Relational Algebra. Example Relation Instances

SQL Queries. COSC 304 Introduction to Database Systems SQL. Example Relations. SQL and Relational Algebra. Example Relation Instances COSC 304 Introduction to Database Systems SQL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Queries Querying with SQL is performed using a SELECT statement. The general

More information

In this exercise you will practice some more SQL queries. First let s practice queries on a single table.

In this exercise you will practice some more SQL queries. First let s practice queries on a single table. More SQL queries In this exercise you will practice some more SQL queries. First let s practice queries on a single table. 1. Download SQL_practice.accdb to your I: drive. Launch Access 2016 and open the

More information

More on MS Access queries

More on MS Access queries More on MS Access queries BSAD 141 Dave Novak Topics Covered MS Access query capabilities Aggregate queries Different joins Review: AND and OR Parameter query Exact match criteria versus range Formatting

More information

DB - Week 3 Lab1-2 Introduction to Databases. Dina A. Said

DB - Week 3 Lab1-2 Introduction to Databases. Dina A. Said DB - Week 3 Lab1-2 Introduction to Databases Dina A. Said dasaid@ucalgary.ca Relationships Create a relationship as follows: One-to-many s.t. field author_id in titles table is a foreign key from field

More information

SQL Data Querying and Views

SQL Data Querying and Views Course A7B36DBS: Database Systems Lecture 04: SQL Data Querying and Views Martin Svoboda Faculty of Electrical Engineering, Czech Technical University in Prague Outline SQL Data manipulation SELECT queries

More information

Types. Inner join ( Equi Joins ) Outer(left, right, full) Cross. Prepared By : - Chintan Shah & Pankti Dharwa 2

Types. Inner join ( Equi Joins ) Outer(left, right, full) Cross. Prepared By : - Chintan Shah & Pankti Dharwa 2 Sometimes it necessary to work with multiple tables as through they were a single entity. Then single SQL sentence can manipulate data from all the tables. Join are used to achive this. Tables are joined

More information

PowerPoint Presentation to Accompany GO! All In One. Chapter 13

PowerPoint Presentation to Accompany GO! All In One. Chapter 13 PowerPoint Presentation to Accompany GO! Chapter 13 Create, Query, and Sort an Access Database; Create Forms and Reports 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Objectives Identify Good

More information

Business Insight Authoring

Business Insight Authoring Business Insight Authoring Getting Started Guide ImageNow Version: 6.7.x Written by: Product Documentation, R&D Date: August 2016 2014 Perceptive Software. All rights reserved CaptureNow, ImageNow, Interact,

More information

Structure Query Language (SQL)

Structure Query Language (SQL) Structure Query Language (SQL) 1 Example to Select all Records from Table A special character asterisk * is used to address all the data(belonging to all columns) in a query. SELECT statement uses * character

More information

Database Management Systems,

Database Management Systems, Database Management Systems SQL Query Language (3) 1 Topics Aggregate Functions in Queries count sum max min avg Group by queries Set Operations in SQL Queries Views 2 Aggregate Functions Tables are collections

More information

Database Programming with PL/SQL

Database Programming with PL/SQL Database Programming with PL/SQL Review of SQL Group Functions and Subqueries 1 Copyright 2013, Oracle and/or its affiliates. All rights Objectives In this lesson, you will review how to construct and

More information

GIFT Department of Computing Science. CS-217: Database Systems. Lab-4 Manual. Reporting Aggregated Data using Group Functions

GIFT Department of Computing Science. CS-217: Database Systems. Lab-4 Manual. Reporting Aggregated Data using Group Functions GIFT Department of Computing Science CS-217: Database Systems Lab-4 Manual Reporting Aggregated Data using Group Functions V3.0 4/28/2016 Introduction to Lab-4 This lab further addresses functions. It

More information

CIS 363 MySQL. Chapter 12 Joins Chapter 13 Subqueries

CIS 363 MySQL. Chapter 12 Joins Chapter 13 Subqueries CIS 363 MySQL Chapter 12 Joins Chapter 13 Subqueries Ch.12 Joins TABLE JOINS: Involve access data from two or more tables in a single query. The ability to join two or more tables together is called a

More information

SQL - Tables. SQL - Create a SQL Table. SQL Create Table Query:

SQL - Tables. SQL - Create a SQL Table. SQL Create Table Query: SQL - Tables Data is stored inside SQL tables which are contained within SQL databases. A single database can house hundreds of tables, each playing its own unique role in th+e database schema. While database

More information

4. SQL - the Relational Database Language Standard 4.3 Data Manipulation Language (DML)

4. SQL - the Relational Database Language Standard 4.3 Data Manipulation Language (DML) Since in the result relation each group is represented by exactly one tuple, in the select clause only aggregate functions can appear, or attributes that are used for grouping, i.e., that are also used

More information

Lecture 06. Fall 2018 Borough of Manhattan Community College

Lecture 06. Fall 2018 Borough of Manhattan Community College Lecture 06 Fall 2018 Borough of Manhattan Community College 1 Introduction to SQL Over the last few years, Structured Query Language (SQL) has become the standard relational database language. More than

More information

COSC 122 Computer Fluency. Databases. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 122 Computer Fluency. Databases. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 122 Computer Fluency Databases Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Databases allow for easy storage and retrieval of large amounts of information.

More information

COSC 304 Introduction to Database Systems SQL. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 304 Introduction to Database Systems SQL. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 304 Introduction to Database Systems SQL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Queries Querying with SQL is performed using a SELECT statement. The general

More information

5 SQL (Structured Query Language)

5 SQL (Structured Query Language) 5 SQL (Structured Query Language) 5.1 SQL Commands Overview 5.1.1 Structured Query Language (SQL) commands FoxPro supports Structured Query Language (SQL) commands. FoxPro's SQL commands make use of Rushmore

More information

Getting Information from a Table

Getting Information from a Table ch02.fm Page 45 Wednesday, April 14, 1999 2:44 PM Chapter 2 Getting Information from a Table This chapter explains the basic technique of getting the information you want from a table when you do not want

More information

T-SQL Training: T-SQL for SQL Server for Developers

T-SQL Training: T-SQL for SQL Server for Developers Duration: 3 days T-SQL Training Overview T-SQL for SQL Server for Developers training teaches developers all the Transact-SQL skills they need to develop queries and views, and manipulate data in a SQL

More information

2) SQL includes a data definition language, a data manipulation language, and SQL/Persistent stored modules. Answer: TRUE Diff: 2 Page Ref: 36

2) SQL includes a data definition language, a data manipulation language, and SQL/Persistent stored modules. Answer: TRUE Diff: 2 Page Ref: 36 Database Processing, 12e (Kroenke/Auer) Chapter 2: Introduction to Structured Query Language (SQL) 1) SQL stands for Standard Query Language. Diff: 1 Page Ref: 32 2) SQL includes a data definition language,

More information

SAS seminar. The little SAS book Chapters 3 & 4. April 15, Åsa Klint. By LD Delwiche and SJ Slaughter. 3.1 Creating and Redefining variables

SAS seminar. The little SAS book Chapters 3 & 4. April 15, Åsa Klint. By LD Delwiche and SJ Slaughter. 3.1 Creating and Redefining variables SAS seminar April 15, 2003 Åsa Klint The little SAS book Chapters 3 & 4 By LD Delwiche and SJ Slaughter Data step - read and modify data - create a new dataset - performs actions on rows Proc step - use

More information

An Introduction to Stata

An Introduction to Stata An Introduction to Stata Instructions Statistics 111 - Probability and Statistical Inference Jul 3, 2013 Lab Objective To become familiar with the software package Stata. Lab Procedures Stata gives us

More information

Full file at

Full file at David Kroenke's Database Processing: Fundamentals, Design and Implementation (10 th Edition) CHAPTER TWO INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) True-False Questions 1. SQL stands for Standard

More information

Key Points. COSC 122 Computer Fluency. Databases. What is a database? Databases in the Real-World DBMS. Database System Approach

Key Points. COSC 122 Computer Fluency. Databases. What is a database? Databases in the Real-World DBMS. Database System Approach COSC 122 Computer Fluency Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) allow for easy storage and retrieval of large amounts of information. 2) Relational

More information

MySQL and MariaDB. March, Introduction 3

MySQL and MariaDB. March, Introduction 3 MySQL and MariaDB March, 2018 Contents 1 Introduction 3 2 Starting SQL 3 3 Databases 3 i. See what databases exist........................... 3 ii. Select the database to use for subsequent instructions..........

More information

SECTION 1 DBMS LAB 1.0 INTRODUCTION 1.1 OBJECTIVES 1.2 INTRODUCTION TO MS-ACCESS. Structure Page No.

SECTION 1 DBMS LAB 1.0 INTRODUCTION 1.1 OBJECTIVES 1.2 INTRODUCTION TO MS-ACCESS. Structure Page No. SECTION 1 DBMS LAB DBMS Lab Structure Page No. 1.0 Introduction 05 1.1 Objectives 05 1.2 Introduction to MS-Access 05 1.3 Database Creation 13 1.4 Use of DBMS Tools/ Client-Server Mode 15 1.5 Forms and

More information

NESTED QUERIES AND AGGREGATION CHAPTER 5 (6/E) CHAPTER 8 (5/E)

NESTED QUERIES AND AGGREGATION CHAPTER 5 (6/E) CHAPTER 8 (5/E) 1 NESTED QUERIES AND AGGREGATION CHAPTER 5 (6/E) CHAPTER 8 (5/E) 2 LECTURE OUTLINE More Complex SQL Retrieval Queries Self-Joins Renaming Attributes and Results Grouping, Aggregation, and Group Filtering

More information