SQL201W Accelerated Introduction to SQL Using MySQL. Covers create, alter,drop, select, insert,update and delete. Includes joins, calculations and grouping.
SQL212 Accelerated Introduction to SQL Using oracle. Covers create, alter, drop, insert, update, delete. Includes joins, inner and outer, subqueries, calculations and grouping.
The special edition of Microsoft's SQL Database - The Cloud Edition. The special edition of this session - presenting first time for SQL Soton Event. Even this session is dedicated for beginners, we going a little deeper than You expected. In a first part of my session we executing a short version of SWOT analyze, in a second we trying touch the sky, and at the end we discuss about our (the SQL DBA's), future.
SQL212 Accelerated Introduction to SQL Using oracle. Covers create, alter, drop, insert, update, delete. Includes joins, inner and outer, subqueries, calculations and grouping.
The special edition of Microsoft's SQL Database - The Cloud Edition. The special edition of this session - presenting first time for SQL Soton Event. Even this session is dedicated for beginners, we going a little deeper than You expected. In a first part of my session we executing a short version of SWOT analyze, in a second we trying touch the sky, and at the end we discuss about our (the SQL DBA's), future.
Introduction to MySQL, and its features with an explanation of the various processes that should be followed in order to have an efficient MySQL implementation.
Microsoft released SQL Azure more than two years ago - that's enough time for testing (I hope!). So, are you ready to move your data to the Cloud? If you’re considering a business (i.e. a production environment) in the Cloud, you need to think about methods for backing up your data, a backup plan for your data and, eventually, restoring with Red Gate Cloud Services. In this session, you’ll see the differences, functionality, restrictions, and opportunities in SQL Azure and On-Premise SQL Server 2008/2008 R2/2012. We’ll consider topics such as how to be prepared for backup and restore, and which parts of a cloud environment are most important: keys, triggers, indexes, prices, security, service level agreements, etc.
Introduction to SQL Server Analysis services 2008Tobias Koprowski
This is my presentation from 17th Polish SQL server User Group Meeting in Wroclaw. It\'s first part of Quadrology Bussiness Intelligence for ITPros Cycle.
On my first session I would to introduce everyone to formerly known SQL Azure (actually Windows Azure SQL Database). Under Tips and Trick session I will show which points, features, compatibility and non-compatibility for SQL Azure are important for DBA's. I will cover functionalities, performance, cost, and sla and security aspects.
After break I will show how we can work with our data in the Cloud using SQL Azure, Blob Storage, what functionality of backup, restore, encryption and availability are available for us, how we can implement hybrid environment and when an why it is (or not) good practice.
And finally I hope we will find few minutes for discussion about Future of the DBA (not only in AD 2016)
An overview of microsoft data mining technologyMark Tabladillo
Microsoft has provided data mining technology in their SQL Server product since 2000, being the first major database vendor to put analytics at the database. SQL Server 2012 continues that leadership including the newly introduced semantic search (for text mining). This demonstration talk will outline this SQL Server technology, including the Excel 2013 add-in, SQL Server Integration Services for production scoring and data cleaning, and semantic search for text mining. This talk is appropriate for people new to data mining
SQL Saturday 79 Enterprise Data Mining for SQL Server 2008 R2Mark Tabladillo
This presentation introduces SQL Server Data Mining (SSDM) for SQL Server Professionals based on the speaker's past presentation for Microsoft TechEd. Starting with SQL Server Management Studio (SSMS), the demo includes the interfaces important for professional development, including Business Intelligence Development Studio (BIDS), highlighting Integration Services, and PowerShell. The interactive demos are based on Microsoft's Contoso Retail sample data. Finally we will evaluate where Microsoft data mining can help you in a practical business environment, which may include Oracle and SAS.
If you have a SQL Server license (Standard or higher) then you already have the ability to start data mining. In this new presentation, you will see how to scale up data mining from the free Excel 2013 add-in to production use. Aimed at beginning to intermediate data miners, this presentation will show how mining models move from development to production. We will use SQL Server 2012 tools including SSMS, SSIS, and SSDT. Technology includes SQL Server 2012 SP1, Office 2013, Windows 8 Professional.
• We sleeping well. And our mobile ringing and ringing. Message: DISASTER! In this session (on slides) we are NOT talk about potential disaster (such BCM); we talk about: And what NOW? New version old my old well-known session updated for whole changes which happened in DBA World in last two-three years.
• So, from the ground to the Sky and further - everything for surviving disaster. Which tasks should have been finished BEFORE. Is virtual or physical SQL matter? We talk about systems, databases, peoples, encryption, passwords, certificates and users.
• In this session (on few demos) I'll show which part of our SQL Server Environment are critical and how to be prepared to disaster. In some documents I'll show You how to be BEST prepared.
Introduction to MySQL, and its features with an explanation of the various processes that should be followed in order to have an efficient MySQL implementation.
Microsoft released SQL Azure more than two years ago - that's enough time for testing (I hope!). So, are you ready to move your data to the Cloud? If you’re considering a business (i.e. a production environment) in the Cloud, you need to think about methods for backing up your data, a backup plan for your data and, eventually, restoring with Red Gate Cloud Services. In this session, you’ll see the differences, functionality, restrictions, and opportunities in SQL Azure and On-Premise SQL Server 2008/2008 R2/2012. We’ll consider topics such as how to be prepared for backup and restore, and which parts of a cloud environment are most important: keys, triggers, indexes, prices, security, service level agreements, etc.
Introduction to SQL Server Analysis services 2008Tobias Koprowski
This is my presentation from 17th Polish SQL server User Group Meeting in Wroclaw. It\'s first part of Quadrology Bussiness Intelligence for ITPros Cycle.
On my first session I would to introduce everyone to formerly known SQL Azure (actually Windows Azure SQL Database). Under Tips and Trick session I will show which points, features, compatibility and non-compatibility for SQL Azure are important for DBA's. I will cover functionalities, performance, cost, and sla and security aspects.
After break I will show how we can work with our data in the Cloud using SQL Azure, Blob Storage, what functionality of backup, restore, encryption and availability are available for us, how we can implement hybrid environment and when an why it is (or not) good practice.
And finally I hope we will find few minutes for discussion about Future of the DBA (not only in AD 2016)
An overview of microsoft data mining technologyMark Tabladillo
Microsoft has provided data mining technology in their SQL Server product since 2000, being the first major database vendor to put analytics at the database. SQL Server 2012 continues that leadership including the newly introduced semantic search (for text mining). This demonstration talk will outline this SQL Server technology, including the Excel 2013 add-in, SQL Server Integration Services for production scoring and data cleaning, and semantic search for text mining. This talk is appropriate for people new to data mining
SQL Saturday 79 Enterprise Data Mining for SQL Server 2008 R2Mark Tabladillo
This presentation introduces SQL Server Data Mining (SSDM) for SQL Server Professionals based on the speaker's past presentation for Microsoft TechEd. Starting with SQL Server Management Studio (SSMS), the demo includes the interfaces important for professional development, including Business Intelligence Development Studio (BIDS), highlighting Integration Services, and PowerShell. The interactive demos are based on Microsoft's Contoso Retail sample data. Finally we will evaluate where Microsoft data mining can help you in a practical business environment, which may include Oracle and SAS.
If you have a SQL Server license (Standard or higher) then you already have the ability to start data mining. In this new presentation, you will see how to scale up data mining from the free Excel 2013 add-in to production use. Aimed at beginning to intermediate data miners, this presentation will show how mining models move from development to production. We will use SQL Server 2012 tools including SSMS, SSIS, and SSDT. Technology includes SQL Server 2012 SP1, Office 2013, Windows 8 Professional.
• We sleeping well. And our mobile ringing and ringing. Message: DISASTER! In this session (on slides) we are NOT talk about potential disaster (such BCM); we talk about: And what NOW? New version old my old well-known session updated for whole changes which happened in DBA World in last two-three years.
• So, from the ground to the Sky and further - everything for surviving disaster. Which tasks should have been finished BEFORE. Is virtual or physical SQL matter? We talk about systems, databases, peoples, encryption, passwords, certificates and users.
• In this session (on few demos) I'll show which part of our SQL Server Environment are critical and how to be prepared to disaster. In some documents I'll show You how to be BEST prepared.
Your first reporting assignment as a multimedia journalist can be frightening. Here are some lessons learned and words of encouragement UNC student Lander Atkinson during Spring 2009. For more of her work, visit www.ncdropout.org.
Created with the support of an APPLES Ueltschi Course Development Grant and the School of Journalism and Mass Communication at UNC-Chapel Hill.
Soundslides is a fantastic tool for journalists who want to tell a story with photos and sound. UNC student Erin Smith guides journalists through an introduction to the program.
By Erin Smith, UNC-Chapel Hill student
School of Journalism and Mass Communication
APPLES Ueltschi Course Development Grant
Presentation to the CISTI New Ideas Forum (Jan 12, 2006) describing the potential benefits of SOA with regard to integration with client tools/applications on the desktop or in the browser.
SQL302 Intermediate SQL using Microsoft SQL Server. Covers additional uses of subqueries, set functions, table expressions, with clause, new SQL window functions.
Geek Sync | Locating and Resolving Common Database Performance Issues in Micr...IDERA Software
You can watch the replay for this Geek Sync webcast in the IDERA Resource Center: http://ow.ly/8wTs50A5bgc
No database professional can afford to avoid performance issues, no matter how big or small. What best practices are you following?
Join IDERA and Devin Gallagher on Thursday, November 2 at 4 PM CT as he walks through locating and resolving common database performance issues. Devin will explore hot objects, poor performing SQL, missing or bad indexes and more. Catch an inside look into DB Optimizer with a technical specialist and learn how it successfully automates SQL tuning and profiling, and locates and resolves many of your common and not-so-common performance issues. Devin will also look at some performance drill down areas within Aqua Data Studio.
Attending PASS Summit? This will be a special live Geek Sync you will not want to miss in Booth 112.
Embarcadero® Rapid SQL® is an award-winning SQL IDE giving database developers and DBAs
the ability to create high-performing SQL code on all major databases from a single interface.
The toolset simplifies SQL scripting, query building, object management, debugging, and version
control with easy-to-use, innovative tools.
An outline on why the MySQL 8 release is viewed as a gamechanger with a look at some of the new features like CTEs, Window Functions, MySQL InnoDB Cluster, Enterprise Data Masking, and more
Azure Synapse Analytics is Azure SQL Data Warehouse evolved: a limitless analytics service, that brings together enterprise data warehousing and Big Data analytics into a single service. It gives you the freedom to query data on your terms, using either serverless on-demand or provisioned resources, at scale. Azure Synapse brings these two worlds together with a unified experience to ingest, prepare, manage, and serve data for immediate business intelligence and machine learning needs. This is a huge deck with lots of screenshots so you can see exactly how it works.
Short course on using Visio 2016 to create an Entity Relationship Diagram (ERD). Covers entities, attributes and relationships: 1 to 1, 1 to many, many to many and recursive.
Basic Project Libre training course. Based on a similar Microsoft Project Basic course. Covers setting up the project environment and creating the project plan.
Quick introduction to coding using Python.. Covers data types, data structures, variables, assignment, selection, iteration, classes, objects and subclasses.
Shows how to create a self join in Microsoft Access. A self join is a table joined to itself. This presentation uses employees reporting to their supervisor in the same table as an example.
AIN106 Microsoft Access Reporting and Analysis. This course emphasizes tables, data, queries and reports. It is designed for those who will be using Access primarily for decision support as opposed to data entry.
Third module of SQL302 intermediate SQL course. Covers using subqueries in updates and deletes, update from and delete from, views, and altering tables.
SQL202.3 Accelerated Introduction to SQL Using SQL Server Module 3Dan D'Urso
Accelerated Introduction to SQL using Microsoft SQL Server. Covers insert, update, delete, create, drop, alter statements. Includes views, indexes, tables, constraints.
SQL202.2 Accelerated Introduction to SQL Using SQL Server Module 2Dan D'Urso
Accelerated Introduction to SQL Using Microsoft SQL Server Module 2. Covers inner, outer and self joins, correlated and uncorrelated subqueries, unions, aggregate functions, calculated fields and grouping.
SQL202.1 Accelerated Introduction to SQL Using SQL Server Module 1Dan D'Urso
SQL202 Accelerated Introduction to SQL Using Microsoft SQL Server Module 1. Covers relational database concepts, basic select statements, filtering results, special operators, wildcards, sorting, removing duplicates and selecting the top values.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
The Metaverse and AI: how can decision-makers harness the Metaverse for their...Jen Stirrup
The Metaverse is popularized in science fiction, and now it is becoming closer to being a part of our daily lives through the use of social media and shopping companies. How can businesses survive in a world where Artificial Intelligence is becoming the present as well as the future of technology, and how does the Metaverse fit into business strategy when futurist ideas are developing into reality at accelerated rates? How do we do this when our data isn't up to scratch? How can we move towards success with our data so we are set up for the Metaverse when it arrives?
How can you help your company evolve, adapt, and succeed using Artificial Intelligence and the Metaverse to stay ahead of the competition? What are the potential issues, complications, and benefits that these technologies could bring to us and our organizations? In this session, Jen Stirrup will explain how to start thinking about these technologies as an organisation.
Elevating Tactical DDD Patterns Through Object CalisthenicsDorra BARTAGUIZ
After immersing yourself in the blue book and its red counterpart, attending DDD-focused conferences, and applying tactical patterns, you're left with a crucial question: How do I ensure my design is effective? Tactical patterns within Domain-Driven Design (DDD) serve as guiding principles for creating clear and manageable domain models. However, achieving success with these patterns requires additional guidance. Interestingly, we've observed that a set of constraints initially designed for training purposes remarkably aligns with effective pattern implementation, offering a more ‘mechanical’ approach. Let's explore together how Object Calisthenics can elevate the design of your tactical DDD patterns, offering concrete help for those venturing into DDD for the first time!
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
91mobiles recently conducted a Smart TV Buyer Insights Survey in which we asked over 3,000 respondents about the TV they own, aspects they look at on a new TV, and their TV buying preferences.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofsAlex Pruden
This paper presents Reef, a system for generating publicly verifiable succinct non-interactive zero-knowledge proofs that a committed document matches or does not match a regular expression. We describe applications such as proving the strength of passwords, the provenance of email despite redactions, the validity of oblivious DNS queries, and the existence of mutations in DNA. Reef supports the Perl Compatible Regular Expression syntax, including wildcards, alternation, ranges, capture groups, Kleene star, negations, and lookarounds. Reef introduces a new type of automata, Skipping Alternating Finite Automata (SAFA), that skips irrelevant parts of a document when producing proofs without undermining soundness, and instantiates SAFA with a lookup argument. Our experimental evaluation confirms that Reef can generate proofs for documents with 32M characters; the proofs are small and cheap to verify (under a second).
Paper: https://eprint.iacr.org/2023/1886
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Epistemic Interaction - tuning interfaces to provide information for AI support
SQL201W MySQL SQL Manual
1. Orange Coast Database Associates Course (800)355-9855 or http://www.d2associates.com
SQL201W Accelerated Introduction
to SQL Using MySQL
Orange Coast
Database Associates
Specializing in Microsoft Office,
Access, SQL, and related technologies
Classes custom designed for Working Professionals
http://www.d2associates.com
San Juan Capistrano, CA
(800)355-9855
Accelerated Computer Training for Working Professionals Bookstore Case
2. Welcome to SQL201W –
Accelerated Introduction to
SQL Using MySQL
An accelerated introduction to SQL for non-
programmers
P.O. Box 6142
Laguna Niguel, CA 92607
949-489-1472
http://www.d2associates.com
Bookstore SQL201W 1
Accelerated Introduction to
SQL
• Introduction (s)
• Facilities
• Course Packet (contents may vary)
– Student questionnaire
– Collaterals (Maps, Catalogs, Etc.)
– PowerPoint handouts for all sessions
– Evaluation form
– Training certificate
Bookstore SQL201W 2
1
3. SQL Curriculum
SQL201W SQL202 SQL212
MySQL Transact-SQL Oracle
SQL200* * = included in
above courses
SQL200S*
Bookstore SQL201W 3
Accelerated Introduction to SQL
• Assumes no prior knowledge of SQL
• Quick pace for experienced computer users
• End-user, not programmer, oriented
• Focus is on SQL, not Management Studio
• SQL200s is first two modules of SQL200,
otherwise identical.
Bookstore SQL201W 4
2
4. Accelerated Introduction to
SQL
SQL Covered (Day 1: All Day):
• Select
– Basic
– Filters
– Special Operators
– Multi-table retrieval
• Joins
• Subqueries
• Unions
– Calculations and
Aggregates
Bookstore SQL201W 5
Accelerated Introduction to
SQL
SQL Covered (Day 2: AM Only):
• Data Updates
– Insert
– Update
– Delete
• Data structures
– Create
– Drop
– Alter
Bookstore SQL201W 6
3
5. Accelerated Introduction to
SQL
Course Format:
• 3 Sessions
• Lecture
• Demo
• Student “hands-on”
• Many exercises are cumulative –
later examples build on queries
created earlier
Bookstore SQL201W 7
Accelerated Introduction to
SQL
Course Schedule (“1/2” day sessions):
• Session 1 – Basic SQL
• Session 2 – Multi-table
Retrieval
• Session 3 – Modifying Data
Bookstore SQL201W 8
4
6. SQL201W
SQL Programming
Based on SQL Clearly Explained by Jan Harrington
Module 1 – Relational Database Background,
Basic Single Table Retrieval Operations
Bookstore SQL201W Module 1 1
Note on SQL200 Slides
• These slides were originally designed to support the
single SQL200 course which was used for any of
MS Access, MySQL, Oracle and SQL Server.
• As such you may see here slides developed in any
one of the above products.
• We are in the process of migrating the various
vendor slides out into their own slide sets. The
SQL200 slides will cover MySQL and SQL Server
which are virtually identical for purposes of this
course.
Bookstore SQL201W Module 1 2
1
7. Warning!
• Below are some table name changes to be
aware of in doing queries. We have created
synonyms so either name should work.
New Name Old Name
Orders Order_filled
Order_Lines Orderlines
Bookstore SQL201W Module 1 3
SQL200 Contact Information
P.O. Box 6142
Laguna Niguel, CA 92607
949-489-1472
http://www.d2associates.com
slides.1@dhdursoassociates.com
Copyright 2001-2011. All rights reserved.
Bookstore SQL201W Module 1 4
2
8. SQL200 Resources
• Bookstore database scripts found on
box.net at
http://tinyurl.com/SQLScripts
• Slides can be viewed on SlideShare…
http://www.slideshare.net/OCDatabases
• Follow up questions?
sql.support@dhdursoassociates.com
Bookstore SQL201W Module 1 5
SQL Programming
• Course focus is SQL language
• Widely used for:
– Database administration
– Enterprise application development
– Data driven web sites
• A foundation skill for eBusiness and
almost all major business applications that
use relational databases
Bookstore SQL201W Module 1 6
3
9. SQL Programming
• A basic knowledge of query systems,
perhaps via MS Access, or some
programming knowledge, is desirable
• We will use GUI tools or SQL Plus almost
exclusively
Bookstore SQL201W Module 1 7
Relational Database Evolution
• Based on Codd’s paper
• Early commercial efforts focused on Unix
• First mainframe implementation by IBM -
precursor to today’s DB2
• First PC implementation in early 80’s by
Oracle
Bookstore SQL201W Module 1 8
4
11. Constraints
• Database • Other Business Rule
– Domain – Triggers
– Uniqueness – Stored Procedures
– Relationship
Cardinality
• 1 to 1
• 1 to N
Bookstore SQL201W Module 1 11
Relational Database with constraints
Bookstore SQL201W Module 1 12
6
12. Database Management Systems
Positioning Chart
Cost VLDB
Enterprise
Workgroup
Single user
Spreadsheet
# Users
Bookstore SQL201W Module 1 13
System Architecture
File Server
Architecture
Access
MDB
Access
Bookstore SQL201W Module 1 14
7
13. System Architecture
Client/Server
Architecture
MySQL
SQL DB
Visual Access
Basic App
Bookstore SQL201W Module 1 15
System Architecture
Web
Architecture
Web MySQL
Server DB
SQL
Browser
Bookstore SQL201W Module 1 16
8
14. Approaching SQL
• Relatively simple
• Two main environments
– Interactive (This course)
– Embedded
• Static (Compiled)
• Dynamic
Bookstore SQL201W Module 1 17
SQL Standardization
ANSI standardization
– First standard in 1986
– SQL 89
– SQL 92
– SQL 99
• Various vendor extensions
– Microsoft/Sybase: T-SQL
– Oracle: PL/SQL
Bookstore SQL201W Module 1 18
9
15. SQL Conformance
• Entry
• Intermediate
• Advanced
• Most are at least entry level
Bookstore SQL201W Module 1 19
SQL Statements
• Data Manipulation Language (DML)
• Data Control Language (DCL)
• Data Definition Language (DDL)
• Note: SQL 99 changes these to seven types
Bookstore SQL201W Module 1 20
10
16. SQL DDL
• Data definition language (DDL)
– Create, alter, drop, etc.
– Frequently implemented via various CASE
tools: Visio, Embarcadero, ERWin, etc.
– But very useful for database administration
Bookstore SQL201W Module 1 21
SQL DCL
• Data Control Language (DDL)
– Grant
– Revoke
– Deny
– Constraints
Bookstore SQL201W Module 1 22
11
18. Bookstore Sample Database
• Before we continue (note: instructor may have
already done this)…
• Load the sample database if you haven’t already
– Start the MySQL Control center
– Load and run the MySQL
“builddb_bookstore_mysql.sql” script
Bookstore SQL201W Module 1 25
Text Conventions
• In Access character strings are normally
surrounded by double quotes
– “Jones”
• In an enterprise database such as Oracle or
MySQL enclose text strings in single
quotes
– ‘Jones’
Bookstore SQL201W Module 1 26
13
19. Date Conventions
• In an enterprise database such as Oracle or
SQL Sever, enclose dates in single quotes
– ‘2004-12-23’ MySQL
– ’12-23-2004’ SQL Server
– ’23-DEC-04’ Oracle
Bookstore SQL201W Module 1 27
Listing the Tables
Bookstore SQL201W Module 1 28
14
20. Describing a Table
Bookstore SQL201W Module 1 29
Select statement clauses
SELECT…
INTO…
FROM…
WHERE…
GROUP BY…
HAVING…
ORDER BY…
Bookstore SQL201W Module 1 30
15
21. SELECT
Basic Syntax (Projection):
Select <column-list> or <*>
From <table-list>
Bookstore SQL201W Module 1 31
SELECT
Basic Example (Projection):
select
customer_last_name,
customer_street
from customers
Bookstore SQL201W Module 1 32
16
22. MySQL Select Query
Bookstore SQL201W Module 1 33
SELECT with Where Clause
Example (Restriction plus Projection):
Select <column-list> or *
From <table-list>
Where <selection-criteria>;
Bookstore SQL201W Module 1 34
17
23. Comparison Operators
• < less than
• > greater than
• <= less than or equal to
• >= greater than or equal to
• = equal to
• <> or != two forms for not equal
Bookstore SQL201W Module 1 35
SELECT with Where
Basic Example (Restriction plus
Projection):
select customer_last_name,
customer_street
from customers
where customer_last_name =
‘Jones’
Bookstore SQL201W Module 1 36
18
24. Select with Where
Bookstore SQL201W Module 1 37
On Your Own
• Find books written by Mark Twain
• Show title, publisher, year
Bookstore SQL201W Module 1 38
19
25. Complex Predicates
Follow normal boolean logic
Select customer_last_name,
customer_street
From customers
Where (customer_last_name =
‘Jones’ or customer_last_name =
‘Smith’)and customer_state=‘NY’
Bookstore SQL201W Module 1 39
Select with Complex Where
Bookstore SQL201W Module 1 40
20
26. Complex Where Result
Bookstore SQL201W Module 1 41
Special Operators
• Can be used in where clause
• LIKE
• IN
• BETWEEN
• IS NULL
Bookstore SQL201W Module 1 42
21
27. Like (“Wild Card Matches”)
• ANSI wildcards
• Where
customer_last_name
like ‘Jo%’
like ‘Jo_’
Bookstore SQL201W Module 1 43
IN
Select *
From customers
Where customer_last_name in
(‘Rizzo’, ‘Jones’, ‘Garcia’);
The list in parentheses can be replaced by a
subquery. We will study this later.
Bookstore SQL201W Module 1 44
22
28. Select Like
Bookstore SQL201W Module 1 45
SQL Where Clause with IN
Bookstore SQL201W Module 1 46
23
29. IS NULL
SQL uses three valued logic. Must use IS NULL
to test for unknowns. A null is NOT the same as
blank or empty.
Select *
From customers
Where customer_street IS
NULL;
Bookstore SQL201W Module 1 47
IS NULL Results
Bookstore SQL201W Module 1 48
24
30. On Your Own
• Find all customers with an address not equal to
4592 Maple Lane
• Was Peter Johnson selected?
• Why or why not?
Bookstore SQL201W Module 1 49
BETWEEN
List all orders placed in 1999.
select *
from orders
where order_date BETWEEN ‘1-
Jan-99’ and ’31-Dec-99’;
Note: date formats vary from product to product.
Bookstore SQL201W Module 1 50
25
31. Where with Between
Bookstore SQL201W Module 1 51
Removing Duplicates
List once each city in which there are
customers
Select DISTINCT
customer_city
From customers;
Removes duplicate rows from result set
Bookstore SQL201W Module 1 52
26
32. Removing Duplicates
Bookstore SQL201W Module 1 53
Sorting – ORDER BY
Basic syntax:
Select <column list> or *
From <table list>
Where <selection criteria>
Order by <column list> [DESC]
DESC will sort in descending order
Bookstore SQL201W Module 1 54
27
33. Sorting – ORDER BY
List all records sorted by state, city
select *
from customers
order by customer_state,
customer_city
Bookstore SQL201W Module 1 55
Sorting Results with Order By
Bookstore SQL201W Module 1 56
28
34. SQL Exercises
• List all books whose publisher name begins
with “H” or “T”; sort by title [hint: use LIKE]
• List all customers whose last name ends with
“S”; sort by state, city, last name
• Find the order numbers of orders with order
dates in 1999; sort by order #. [Hint: use
BETWEEN]
• Find the order numbers and order dates of all
orders with a “2” in character position 2 of the
credit card #; sort by order date descending
Bookstore SQL201W Module 1 [end module] 57
Notes
Bookstore SQL201W Module 1 58
29
36. SQL201W
SQL Programming
Based on SQL Clearly Explained by Jan Harrington
Workshop 2 – Joins, Calculations and Grouping
Bookstore SQL201W Module 2 1
Note on SQL200 Slides
• These slides were originally designed to support the
single SQL200 course which was used for any of MS
Access, MySQL, Oracle and SQL Server.
• As such you may see here slides developed in any one of
the above products.
• We are in the process of migrating the various vendor
slides out into their own slide sets. The SQL200 slides
will cover MySQL and SQL Server which are virtually
identical for purposes of this course.
Bookstore SQL201W Module 2 2
1
37. Warning!
• Below are some table name changes to be
aware of in doing queries. We have created
synonyms so either name should work.
New Name Old Name
Orders Order_filled
Order_Lines Orderlines
Bookstore SQL201W Module 2 3
SQL200 Contact Information
P.O. Box 6142
Laguna Niguel, CA 92607
949-489-1472
http://www.d2associates.com
slides.1@dhdursoassociates.com
Copyright 2001-20011 All rights reserved.
Bookstore SQL201W Module 2 4
2
38. SQL200 Resources
• Bookstore database scripts found on
box.net at
http://tinyurl.com/SQLScripts
• Slides can be viewed on SlideShare…
http://www.slideshare.net/OCDatabases
• Follow up questions?
sql.support@dhdursoassociates.com
Bookstore SQL201W Module 2 5
SQL201W
SQL Programming
Part 1 – Joins
Bookstore SQL201W Module 2 6
3
39. Relational Database with constraints (from text)
Bookstore SQL201W Module 2 7
More conventions
• Alias names can be surrounded with “ “ as
in “order details”. Better practice is to use
an underscore as in order_details.
• MS Access uses [ ] instead. Some of the
PowerPoint slides may have this
convention. It works equally as well in
SQL Server but not MySQL.
Bookstore SQL201W Module 2 8
4
40. Joins
• Inner
• Outer
– Left
– Right
– Full
• Cross
• Self
• Theta
• We will cover the most important; others as time
and interest permit
Bookstore SQL201W Module 2 9
Bookstore SQL201W Module 2 10
5
41. Inner Join
• Pairs each row from first table with
corresponding row from second table over
the “join column”
• The result set only contains rows where
there is a match over the join column in
both tables
• Equi-join is the common inner join
Bookstore SQL201W Module 2 11
Inner Join
Older Syntax:
Select <column-list>
From <tablelist>
Where <predicate>
Still very commonly used
Bookstore SQL201W Module 2 12
6
42. Inner Join
Example using older syntax:
SELECT customer_first_name,
customer_street, order_numb,
order_date
from customers, orders
Where customers.customer_numb =
orders.customer_numb
Bookstore SQL201W Module 2 13
Inner Join with Result
Bookstore SQL201W Module 2 14
7
43. Inner Join (New Syntax)
Basic SQL 92 Syntax:
Select <column-list>
From <table1>
Inner join <table2>
On <join condition>
Bookstore SQL201W Module 2 15
Inner Join
Basic Example:
SELECT customer_first_name,
customer_street, order_numb,
order_date
from customers
inner join orders
on customers.customer_numb =
orders.customer_numb
Bookstore SQL201W Module 2 16
8
44. Inner Join with Result
Bookstore SQL201W Module 2 17
Inner Join over Multiple columns
• Note that that the join condition can apply
to multiple columns if desired
• Used with composite keys
Bookstore SQL201W Module 2 18
9
45. Inner Join Result in MS Access
Bookstore SQL201W Module 2 19
Inner Join
• In the last example…
– What was the cardinality of the relationship
between customers and orders?
– Which table was the parent?
– What was it’s primary key?
– In which table did we employ a foreign key
and what was it?
Bookstore SQL201W Module 2 20
10
46. Cross Join
• What happens when you omit a join
expression?
• Get the cartesian product of the tables – all
possible combinations of the two tables
• For large tables this will run a long time!
Bookstore SQL201W Module 2 21
Cross Join Result Set
Bookstore SQL201W Module 2 22
11
47. Additional SQL92 Syntax
• Table1 natural join table3 – automatically
uses columns with same name
• Table 1 natural join table2 using(<column-
list>
• Not yet widely available in commercial
implementations
Bookstore SQL201W Module 2 23
Joining More than Two Tables
• Can join several tables in one select
• Try to limit to three or four
• Join order can be important for
performance (although optimizers will
usually handle this for you)
• Use parentheses to force order of
evaluation (also vendor extensions, often
called “hints”)
Bookstore SQL201W Module 2 24
12
48. Joining More than Two Tables
• Add orderlines detail to previous queries
SELECT customer_first_name, customer_street,
orders.order_numb, orders.order_date,
orderlines.isbn, orderlines.quantity
FROM customers
INNER JOIN orders ON
customers.customer_numb=orders.customer_numb
INNER JOIN orderlines
on orders.order_numb = orderlines.order_numb
Bookstore SQL201W Module 2 25
Multi-table Join with Results
Bookstore SQL201W Module 2 26
13
49. On Your Own
• Add the book title to the previous query
results
• Hint: add another join to books table
Bookstore SQL201W Module 2 27
Correlation Names (Table Aliases)
• Can abbreviate references to tables
• For example:
Select e.name, j.payrange
From employees as e
Inner join job_information as j
On e.jobcode = j.jobcode;
Bookstore SQL201W Module 2 28
14
50. Self Joins
• Implements a recursive relationship
• Important in various applications
– Parts lists/assemblies
– HR
– Etc.
– Table joined to itself using correlation names
Bookstore SQL201W Module 2 29
Self Joins
SELECT e.*, m.name
FROM employees AS e, employees
AS m
WHERE e.managerid =
m.employeeid;
Bookstore SQL201W Module 2 30
15
51. Bookstore SQL201W Module 2 31
Outer Joins
• Left – selects all rows from the left or first table,
even if no match exists in the other table
– Widely used in commercial practice
– Especially useful for reporting
– Can be slower and interfere with optimizer
• Right – same idea but all rows from right table
• Full – all rows form both tables
Bookstore SQL201W Module 2 32
16
52. Left Outer Join
Basic SQL 92 Syntax:
Select <column-list>
From <table1>
Left join <table2>
On <join condition>
Bookstore SQL201W Module 2 33
Left-Join
Basic Example:
SELECT customer_first_name,
customer_street, order_numb,
order_date
from customers as c
left join orders as o
on c.customer_numb =
o.customer_numb
Bookstore SQL201W Module 2 34
17
53. Left Join with Results
Bookstore SQL201W Module 2 35
On Your Own
• List all books and corresponding quantities
sold
• Show isbn, title, quantity
• How many books were there?
• Now do the same but include books with
no sales
• Now how many?
Bookstore SQL201W Module 2 36
18
54. SQL200
SQL Programming
Part 2– Subqueries, Unions (Not available in
earlier versions of MySQL)
Bookstore SQL201W Module 2 37
Subqueries
• One select statement embedded in another
• Can be nested multiple levels deep
• Can be used in select, from and where
clauses
• Two types:
– Uncorrelated – executes inner query then outer
– Correlated – executes inner query once for
each outer query row
Bookstore SQL201W Module 2 38
19
55. Uncorrelated Subquery
select isbn, quantity
from orderlines
where order_numb in
(select order_numb from
orders where order_date
between ‘1/1/99’ and
‘12/31/99’);
Bookstore SQL201W Module 2 39
Uncorrelated Subquery with Results
Bookstore SQL201W Module 2 40
20
56. Negative Subquery
• A type of subquery that matches “not
found” conditions
Bookstore SQL201W Module 2 41
Negative Subquery
select isbn, quantity
from orderlines
where order_numb not in
(select order_numb from
orders where order_date
between ‘1/1/99’ and
‘12/31/99’);
Bookstore SQL201W Module 2 42
21
57. Negative Subquery with Results
Bookstore SQL201W Module 2 43
Correlated Subquery with Exists
• Inner subquery executed once for each outer row
• Exists will return true or false depending on
whether the result will have any rows or not
• Can be a quick way to test for existence of
records (parent records, say) as used in
application enforcement of referential integrity
Bookstore SQL201W Module 2 44
22
58. Correlated subquery with Exists
SELECT isbn, quantity
FROM orderlines AS ol
WHERE exists
(select * from orders o where
ol.order_numb = o.order_numb
and o.order_date between ‘1/1/99’
and ‘12/31/99’);
This type of query covered in intermediate SQL class
Bookstore SQL201W Module 2 45
Unions
• Combines two or more tables
• Tables must be union compatible
Bookstore SQL201W Module 2 46
23
59. Unions
Select <column-list> from
<table1>
Union [ALL]
Select <same-columns> from
<table2>
Bookstore SQL201W Module 2 47
Unions
select *
from employees
union all
select *
from employees_copy
Bookstore SQL201W Module 2 48
24
60. Results of Union query
Bookstore SQL201W Module 2 49
SQL200
SQL Programming
Part 3 – Calculations, Aggregates
Bookstore SQL201W Module 2 50
25
61. Calculated Fields
• Can add a column calculated from others
SELECT order_numb, quantity,
cost_each,
quantity*cost_each as
extension
FROM orderlines
Bookstore SQL201W Module 2 51
Calculated Fields
• Can rename the new column, too
SELECT order_numb, quantity,
cost_each,
quantity*cost_each as
extension
FROM Orderlines
Bookstore SQL201W Module 2 52
26
62. Calculated field w/ Given Name
Bookstore SQL201W Module 2 53
Calculated field in the Result
Bookstore SQL201W Module 2 54
27
63. On Your Own
• Calculate the total sales for the books in
earlier query
• Show isbn, titles, quantity, cost_each and
extension
Bookstore SQL201W Module 2 55
String Manipulation
• Concatenation
• Trim
• Substring
• Upper, Lower
• Etc. (various vendor extensions)
Bookstore SQL201W Module 2 56
28
64. Concatenation
• Used for concatenated keys
• Useful to format reports
Basic syntax:
(Access) Field1 & Field2
(Oracle, std) Field1 || Field2
(Sql Server) Field1 + Field2
(MySQL) Concat(field1, field2)
Bookstore SQL201W Module 2 57
Concatenation
select
concat(customer_first_name
,’ ‘,customer_last_name)
as Name
from customers
Bookstore SQL201W Module 2 58
29
65. Concatenation
Bookstore SQL201W Module 2 59
Pretty up the concatenation
• Use trim
functions, add a
space
• Sort by last
name – a neat
trick for
reporting!
Bookstore SQL201W Module 2 60
30
66. Date Functions
• Numerous date functions
• Often vendor specific
• Often used:
– year
– month
• Ex: where year(order_date) = 1999
Bookstore SQL201W Module 2 61
Date Functions
• Remember your three table query with the
order dates?
• Restrict it to orders in December
Bookstore SQL201W Module 2 62
31
67. Aggregate Functions
• Count
• Sum
• Min
• Max
• Avg
• Often used in conjunction with grouping
Bookstore SQL201W Module 2 63
Aggregate Functions
Basic syntax:
Select <function>(<column>)
From <table>
Group by <column-list>
Having <predicate>
Group by all columns to left of one(s)
you want to aggregate
Bookstore SQL201W Module 2 64
32
68. Aggregate Functions
SELECT order_numb, Count(*) AS
[Number of Order Lines] ,
Sum(quantity) AS [Total Quantity],
Sum(quantity * cost_each) AS [Total
Amount]
FROM order_lines
GROUP BY order_numb
having count(*) > 1;
Bookstore SQL201W Module 2 65
Aggregates with Group By
Bookstore SQL201W Module 2 66
33
69. Having Clause
SELECT Order_lines.order_numb,
Count(*) AS ‘Number of Order Lines ‘,
Sum(Order_lines.quantity) AS
Total_Quantity,
Sum(quantity*cost_each) AS extension
FROM Order_lines
GROUP BY Order_lines.order_numb
having count(*) > 1
Bookstore SQL201W Module 2 67
Group By with Having
Bookstore SQL201W Module 2 68
34
70. Having vs. Where
• Having and Where clauses are similar but
not the same
• Having removes groups after they are
formed
• Where removes rows before groups are
formed
Bookstore SQL201W Module 2 69
On Your Own
• Find the aggregates without any grouping –
see what you get
• Then restrict the ISBN
Bookstore SQL201W Module 2 70
35
71. Summary Exercise
• List all customers and their orders
– Name nicely formatted
– With orders in the year of 1999 (do not use
between, etc.)
– Show total order quantities and amounts
– Only include orders with more than three
order lines
Bookstore SQL201W Module 2 71
Exercise Result
[end module]
Bookstore SQL201W Module 2 72
36
72. SQL/200
SQL Programming
Based on SQL Clearly Explained by Jan Harrington
Workshop 3 – Modifying Data, Managing the
Database
Bookstore SQL201W Module 3 1
Note on SQL200 Slides
• These slides were originally designed to support the
single SQL200 course which was used for any of
MS Access, Oracle and SQL Server.
• As such you may see here slides developed in any
one of the above products.
• We are in the process of migrating the various
vendor slides out into their own slide sets. These
SQL200 slides will focus on Microsoft SQL Server
and MySQL which are virtually identical for
purposes of this course.
Bookstore SQL201W Module 3 2
1
73. Warning!
• Below are some table name changes to be
aware of in doing queries. We have created
synonyms so either name should work.
New Name Old Name
Orders Order_filled
Order_Lines Orderlines
Bookstore SQL201W Module 3 3
SQL200 Contact Information
P.O. Box 6142
Laguna Niguel, CA 92607
949-489-1472
http://www.d2associates.com
slides.1@dhdursoassociates.com
Copyright 2001-2011. All rights reserved.
Bookstore SQL201W Module 3 4
2
74. SQL200 Resources
• Bookstore database scripts found on
box.net at
http://tinyurl.com/SQLScripts
• Slides can be viewed on SlideShare…
http://www.slideshare.net/OCDatabases
• Follow up questions?
sql.support@dhdursoassociates.com
Bookstore SQL201W Module 3 5
SQL201W Module 3
• Part 1 – Modifying Data
• Part 2 – Managing Database Structures
• Part 3 – Creating Views and Indexes
• Part 4 -- Security
Bookstore SQL201W Module 3 6
3
75. SQL/201W
SQL Programming
Part 1 – Modifying Data
Bookstore SQL201W Module 3 7
Relational Database with constraints (from text)
Bookstore SQL201W Module 3 8
4
76. Data Modification Statements
• Insert
• Update
• Delete
Bookstore SQL201W Module 3 9
Data Modification Statements
• End-user rarely sees these
statements
• Application developer prepares
these statements “behind the
scenes” based on forms filled out
by user
Bookstore SQL201W Module 3 10
5
77. Insert
• Adds new rows to an existing table
• Two forms:
– Single Row
– Multi-Row
Bookstore SQL201W Module 3 11
Single Row Insert
Basic Syntax:
Insert [into] <table-name>
Values (<value-list>)
Bookstore SQL201W Module 3 12
6
79. Sources table after Insert
Bookstore SQL201W Module 3 15
Multi-row Insert
Basic Syntax:
Insert [into] <table-name>
Select <select-statement>
We will do this after creating a new
table later in this module
Bookstore SQL201W Module 3 16
8
80. Update
• Updates fields in an existing row
Basic Syntax:
Update <table-name>
Set <field1> = new value, <field2> = new
value,…
Where <selection-criteria>
Bookstore SQL201W Module 3 17
Update
• Increase Ingram prices by 10%
Example:
Update books
Set retail_price = retail_price
*1.10
Where source_numb = 1
Bookstore SQL201W Module 3 18
9
81. Ingram Book Prices before Update
Bookstore SQL201W Module 3 19
Ingram Book Prices after Update
Bookstore SQL201W Module 3 20
10
82. After update in MS Access
Bookstore SQL201W Module 3 21
Delete
• Deletes one or more rows
Basic Syntax:
Delete from <table-name>
Where <selection-criteria>
Bookstore SQL201W Module 3 22
11
84. Sources table after Delete
Bookstore SQL201W Module 3 25
Delete and Referential Integrity
• Can affect referential integrity when deleting a
“parent” row
• Can do following with child…
– Cascade: delete the child row
– Set null: set the child’s foreign key null
– Set default: as above but to default value
– No action: don’t allow delete of parent row
• Referential integrity can be established when
creating or modifying table structures which we
will look at later in the class
Bookstore SQL201W Module 3 26
13
85. SQL/200
SQL Programming
Part 2– Managing Database Structures
Bookstore SQL201W Module 3 27
DDL
• Create
• Alter
• Drop
Bookstore SQL201W Module 3 28
14
86. Schemas
• Logical view of a database; sort of a “sub-
database” – we will not cover these in this
module or…
– Catalogs
– Clusters
– Domains (somewhat like a user defined datatype)
• These topics are highly dependent upon the
vendor DBMS and installation practices
Bookstore SQL201W Module 3 29
Tables
• Base tables
• Temporary tables
– Local (or module scope)
– Global (session scope)
Bookstore SQL201W Module 3 30
15
87. Creating Tables
• Use create statement
• Specify:
– Columns with data types and column
constraints
– Table constraints
• Foreign key references
• Primary key designation
Bookstore SQL201W Module 3 31
Data Types
• Int – integers or whole numbers
– Ex: how_many int
• Char – fixed length fields
– Ex: state char(2)
• Varchar/Varchar2 – variable length fields
– Ex: address varchar(35)
• Money – money field; same as MS Access
currency
• Date/Datetime – date and time
• And many others – see documentation or Help
Bookstore SQL201W Module 3 32
16
88. Create Table
Basic syntax:
Create table <table-name>
<column1> <datatype> <constraints>
,.. <column1> <datatype> <constraints>
…
<table constraints>
Note: often preceded by a drop
Bookstore SQL201W Module 3 33
Temporary Tables
Basic syntax (SQL standard):
Create [global] temporary table <table-name>
<rest of statement as for normal create>
Note: SQL Server uses a different syntax. Just put
a #in front of the table name as in #mytable.
Bookstore SQL201W Module 3 34
17
90. But first – the Drop Statement
• Deletes a database “object”
– Drop table <table-name>
– Drop view <view-name>
– Drop index <index-name>
– Drop domain <domain-name>
Bookstore SQL201W Module 3 37
Create Table
Example 1: Create a summary table
Create table summary(
isbn varchar(20) primary key,
How_many int check (how_many >= 0),
Constraint isbn_fk
Foreign key (isbn) references
books(isbn)
)
Bookstore SQL201W Module 3 38
19
92. Multi-row Insert
Basic Syntax:
Insert [into] <table-name>
[(<column list>)]
Select <select-statement>
Bookstore SQL201W Module 3 41
Multi-row Insert
Basic Example: (store # times each
book ordered)
Insert into summary
Select isbn, count(*)
From orderlines
Group by isbn;
Bookstore SQL201W Module 3 42
21
93. Multi-row Insert
Bookstore SQL201W Module 3 43
After multi-row insert in MS Access
Bookstore SQL201W Module 3 44
22
94. SQL/200
SQL Programming
Part 3 – Creating Views and Indexes, Modifying
Structures
Bookstore SQL201W Module 3 45
Views
• Think of a view as a named query wherein
the definition is stored in the database
• Can be read like a table
• Some are updateable
Bookstore SQL201W Module 3 46
23
96. Using Views
• Can be used like a table subject to various
limitations
– Cannot insert into grouped queries, etc.
– Etc.
• Sample syntax:
select column-list
from employee_view
Bookstore SQL201W Module 3 49
Using a View
Bookstore SQL201W Module 3 50
25
97. Indexes
• Used to speed searches, joins, etc.
• Placed on:
– primary and foreign keys
– Secondary keys
• In commercial practice often managed by
DBA’s for large databases
Bookstore SQL201W Module 3 51
Indexes
Basic syntax:
Create [unique] index <index-name>
On <table-name> (field-name> [desc])
Note: can place index on a composite key; ex: state and
city
Bookstore SQL201W Module 3 52
26
98. Indexes
Basic example:
create index state_inx
on customers(customer_state)
Bookstore SQL201W Module 3 53
Customers table with index
Bookstore SQL201W Module 3 54
27
99. Dropping an index
Basic Syntax:
– Drop index <table-name.index-name>;
Bookstore SQL201W Module 3 55
Modifying a Table Design
• Applies to tables
• Use ALTER statement
– Add columns
– Delete columns
– Rename columns
– Add column constraints
– Add table constraints
Bookstore SQL201W Module 3 56
28
100. Modifying a Table Design
Basic syntax:
Alter <table-name>
Add <field-name>,
Add <table-constraint>,
Modify <field-name>
Etc.
Bookstore SQL201W Module 3 57
Modify a Table Design
Example: add a phone number field
alter table publishers
add phone char(12);
Bookstore SQL201W Module 3 58
29
101. After alter publishers table
Bookstore SQL201W Module 3 59
SQL/200
SQL Programming
Part 4 – Security
Bookstore SQL201W Module 3 60
30
102. Security
• Important DBA function
– Beyond scope of this course
– Typically controlled through Enterprise
Manager or Studio GUI’s
• In commercial practice application security
frequently controlled via own login and a
“users” table or similar
Bookstore SQL201W Module 3 61
Security
• Specifics can vary by product
• Access: workgroup administrator
• SQL Server: users, roles
• Oracle: users, roles
Bookstore SQL201W Module 3 62
31
103. SQL Security Statements
• Grant
• Revoke
• Deny
Bookstore SQL201W Module 3 63
Grant
Syntax:
Grant <access-right> [with grant option]
On <object> to <user>
Note: by default only tables owners and admins can access
a table. Others must be granted the relevant rights.
Bookstore SQL201W Module 3 64
32
104. Access Rights
• Select
• Update
• Insert
• Delete
• References
• All privileges
Bookstore SQL201W Module 3 65
Grant
Example:
Grant update
On employees to ddurso
Bookstore SQL201W Module 3 66
33
105. Revoke
• Revokes the rights
• Syntax similar to grant
[end module]
Bookstore SQL201W Module 3 67
Notes
Bookstore SQL201W Module 3 68
34
106. Orange Coast Database Associates Course (800)355-9855 or http://www.d2associates.com
Accelerated Computer Training
Orange Coast
Database Associates
Specializing in Microsoft Office,
Access, SQL, and related technologies
Computer Training, Programming & Consulting
32422 Alipaz St., Suite A-15
San Juan Capistrano, CA
(800)355-9855 (Toll Free) | (949)489-1472 (Direct) | (949)485-6284 (Fax)
http://www.d2associates.com | sales@dhdursoassociates.com
Accelerated Computer Training for Working Professionals