Views, Indexes, Authorization. Views. Views 8/6/18. Virtual and Materialized Views Speeding Accesses to Data Grant/Revoke Priviledges
|
|
- Ethelbert Oliver
- 5 years ago
- Views:
Transcription
1 Views, Indexes, Authorization Virtual and Materialized Views Speeding Accesses to Data Grant/Revoke Priviledges 1 Views External Schema (Views) Conceptual Schema Physical Schema 2 Views A view is a relation defined in terms of stored tables (called base tables ) and other views. Two kinds: 1. Virtual = not stored in the database; just a query for constructing the relation. 2. Materialized = actually constructed and stored. 3 1
2 Declaring Views Declare by: CREATE [MATERIALIZED] VIEW <name> AS <query>; Default is virtual. 4 Example: View Definition Define CanDrink(drinker, beer) as a view containing the drinker-beer pairs such that the drinker frequents at least one bar that serves the beer: 5 Recall Our Running Example All our SQL queries will be based on the following database schema. o Underline indicates key attributes. Beers(name, manf) Bars(name, addr, license) Drinkers(name, addr, phone) Likes(drinker, beer) Sells(bar, beer, price) Frequents(drinker, bar) 6 2
3 Example: View Definition Define CanDrink(drinker, beer) as a view containing the drinker-beer pairs such that the drinker frequents at least one bar that serves the beer: CREATE VIEW CanDrink AS SELECT drinker, beer FROM Frequents, Sells WHERE Frequents.bar = Sells.bar; 7 Example: Accessing a View Query a view as if it were a base table. o Also: a limited ability to modify views if it makes sense as a modification of one underlying base table. Example query: SELECT beer FROM CanDrink WHERE drinker = Sally ; 8 Triggers on Views Generally, it is impossible to modify a virtual view, because it doesn t exist. But an INSTEAD OF trigger lets us interpret view modifications in a way that makes sense. Example: View Synergy has (drinker, beer, bar) triples such that the bar serves the beer, the drinker frequents the bar and likes the beer. 9 3
4 Example: The View CREATE VIEW Synergy AS Pick one copy of each attribute SELECT Likes.drinker, Likes.beer, Sells.bar FROM Likes, Sells, Frequents WHERE Likes.drinker = Frequents.drinker AND Likes.beer = Sells.beer AND Sells.bar = Frequents.bar; Natural join of Likes, Sells, and Frequents 10 Interpreting a View Insertion We cannot insert into Synergy --- it is a virtual view. But we can use an INSTEAD OF trigger to turn a (drinker, beer, bar) triple into three insertions of projected pairs, one for each of Likes, Sells, and Frequents. o Sells.price will have to be NULL. 11 The Trigger CREATE TRIGGER ViewTrig INSTEAD OF INSERT ON Synergy REFERENCING NEW ROW AS n FOR EACH ROW BEGIN INSERT INTO LIKES VALUES(n.drinker, n.beer); INSERT INTO SELLS(bar, beer) VALUES(n.bar, n.beer); INSERT INTO FREQUENTS VALUES(n.drinker, n.bar); END; 12 4
5 Materialized Views Problem: each time a base table changes, the materialized view may change. o Cannot afford to recompute the view with each change. Solution: Periodic reconstruction of the materialized view, which is otherwise out of date. 13 Example: A Data Warehouse Wal-Mart stores every sale at every store in a database. Overnight, the sales for the day are used to update a data warehouse = materialized views of the sales. The warehouse is used by analysts to predict trends and move goods to where they are selling best. 14 Indexes Index = data structure used to speed access to tuples of a relation, given values of one or more attributes. Could be a hash table, but in a DBMS it is always a balanced search tree with giant nodes (a full disk page) called a B-tree. 15 5
6 Declaring Indexes No standard! Typical syntax: CREATE INDEX BeerInd ON Beers(manf); CREATE INDEX SellInd ON Sells(bar, beer); 16 Using Indexes Given a value v, the index takes us to only those tuples that have v in the attribute(s) of the index. Example: use BeerInd and SellInd to find the prices of beers manufactured by Pete s and sold by Joe. (next slide) 17 Using Indexes --- (2) SELECT price FROM Beers, Sells WHERE manf = Pete s AND Beers.name = Sells.beer AND bar = Joe s Bar ; 1. Use BeerInd to get all the beers made by Pete s. 2. Then use SellInd to get prices of those beers, with bar = Joe s Bar 18 6
7 Database Tuning A major problem in making a database run fast is deciding which indexes to create. Pro: An index speeds up queries that can use it. Con: An index slows down all modifications on its relation because the index must be modified too. 19 Example: Tuning Suppose the only things we did with our beers database was: 1. Insert new facts into a relation (10%). 2. Find the price of a given beer at a given bar (90%). Then SellInd on Sells(bar, beer) would be wonderful, but BeerInd on Beers(manf) would be harmful. DBMS is not required to use an index even if you create it 20 Tuning Advisors A major research thrust. o Because hand tuning is so hard. An advisor gets a query load, e.g.: 1. Choose random queries from the history of queries run on the database, or 2. Designer provides a sample workload. 21 7
8 Tuning Advisors --- (2) The advisor generates candidate indexes and evaluates each on the workload. o Feed each sample query to the query optimizer, which assumes only this one index is available. o Measure the improvement/degradation in the average running time of the queries. 22 SQL Authorization Privileges Grant and Revoke Grant Diagrams 23 Authorization A file system identifies certain privileges on the objects (files) it manages. o Typically read, write, execute. A file system identifies certain participants to whom privileges may be granted. o Typically the owner, a group, all users. 24 8
9 Privileges (1) SQL identifies a more detailed set of privileges on objects (relations) than the typical file system. Nine privileges in all, some of which can be restricted to one column of one relation. 25 Privileges (2) Some important privileges on a relation: 1. SELECT = right to query the relation. 2. INSERT = right to insert tuples. May apply to only one attribute. 3. DELETE = right to delete tuples. 4. UPDATE = right to update tuples. May apply to only one attribute. 26 Example: Privileges For the statement below: INSERT INTO Beers(name) SELECT beer FROM Sells WHERE NOT EXISTS (SELECT * FROM Beers WHERE name = beer); beers that do not appear in Beers. We add them to Beers with a NULL manufacturer. We require privileges SELECT on Sells and Beers, and INSERT on Beers or Beers.name. 27 9
10 Database Objects The objects on which privileges exist include stored tables and views. Other privileges are the right to create objects of a type, e.g., triggers. Views form an important tool for access control. 28 Example: Views as Access Control We might not want to give the SELECT privilege on Emps(name, addr, salary). But it is safer to give SELECT on: CREATE VIEW SafeEmps AS SELECT name, addr FROM Emps; Queries on SafeEmps do not require SELECT on Emps, just on SafeEmps. 29 Authorization ID s A user is referred to by authorization ID, typically their login name. There is an authorization ID PUBLIC. o Granting a privilege to PUBLIC makes it available to any authorization ID
11 Granting Privileges You have all possible privileges on the objects, such as relations, that you create. You may grant privileges to other users (authorization ID s), including PUBLIC. You may also grant privileges WITH GRANT OPTION, which lets the grantee also grant this privilege. 31 The GRANT Statement To grant privileges, say: GRANT <list of privileges> ON <relation or other object> TO <list of authorization ID s>; If you want the recipient(s) to be able to pass the privilege(s) to others add: WITH GRANT OPTION 32 Example: GRANT Suppose you are the owner of Sells. You may say: GRANT SELECT, UPDATE(price) ON Sells TO sally; Now Sally has the right to issue any query on Sells and can update the price component only
12 Example: Grant Option Suppose we also grant: GRANT UPDATE ON Sells TO sally WITH GRANT OPTION; Now, Sally not only can update any attribute of Sells, but can grant to others the privilege UPDATE ON Sells. o Also, she can grant more specific privileges like UPDATE(price)ON Sells. 34 Revoking Privileges REVOKE <list of privileges> ON <relation or other object> FROM <list of authorization ID s>; Your grant of these privileges can no longer be used by these users to justify their use of the privilege. o But they may still have the privilege because they obtained it independently from elsewhere. 35 REVOKE Options We must append to the REVOKE statement either: 1. CASCADE. Now, any grants made by a revokee are also not in force, no matter how far the privilege was passed. 2. RESTRICT. If the privilege has been passed to others, the REVOKE fails as a warning that something else must be done to chase the privilege down
13 Example: Grant Diagram AP** A: GRANT P TO B WITH GRANT OPTION BP* CP* B: GRANT P TO C WITH GRANT OPTION A owns the object on which P is a privilege CP A: GRANT P TO C 37 Grant Diagrams Nodes = user/privilege/grant option?/is owner? o UPDATE ON R, UPDATE(a) on R, and UPDATE(b) ON R live in different nodes. o SELECT ON R and SELECT ON R WITH GRANT OPTION live in different nodes. Edge X ->Y means that node X was used to grant Y. 38 Notation for Nodes Use AP for the node representing authorization ID A having privilege P. o P * = privilege P with grant option. o P ** = the source of the privilege P. I.e., A is the owner of the object on which P is a privilege. Note ** implies grant option
14 Manipulating Edges (1) When A grants P to B, We draw an edge from AP * or AP ** to BP. o Or to BP * if the grant is with grant option. If A grants a subprivilege Q of P [say UPDATE(a) on R when P is UPDATE ON R] then the edge goes to BQ or BQ *, instead. 40 Manipulating Edges (2) Fundamental rule: User C has privilege Q as long as there is a path from XP ** to CQ, CQ *, or CQ **, and P is a superprivilege of Q. o Remember that P could be Q, and o X could be C. 41 Manipulating Edges (3) If A revokes P from B with the CASCADE option, delete the edge from AP to BP. But if A uses RESTRICT instead, and there is an edge from BP to anywhere, then reject the revocation and make no change to the graph
15 Manipulating Edges (4) Having revised the edges, we must check that each node has a path from some ** node, representing ownership. Any node with no such path represents a revoked privilege and is deleted from the diagram. 43 Example: Grant Diagram AP** A: GRANT P TO B WITH GRANT OPTION BP* CP* B: GRANT P TO C WITH GRANT OPTION A owns the object on which P is a privilege CP A: GRANT P TO C 44 AP** BP* CP* CP Example: Grant Diagram A executes REVOKE P FROM B CASCADE; AP** BP* CP* Even had C passed P to B, both nodes are still cut off. Not only does B lose P*, but C loses P*. Delete BP* and CP*. CP However, C still has P without grant option because of the direct grant
Transactions, Views, Indexes. Controlling Concurrent Behavior Virtual and Materialized Views Speeding Accesses to Data
Transactions, Views, Indexes Controlling Concurrent Behavior Virtual and Materialized Views Speeding Accesses to Data 1 Why Transactions? Database systems are normally being accessed by many users or processes
More informationIntroduction to Transactions: Controlling Concurrent "Behavior" Virtual and Materialized Views" Indexes: Speeding Accesses to Data"
Introduction to Transactions: Controlling Concurrent "Behavior" Virtual and Materialized Views" Indexes: Speeding Accesses to Data" Transaction = process involving database queries and/or modification."
More informationGrouping Operator. Applying γ L (R) Recall: Outerjoin. Example: Grouping/Aggregation. γ A,B,AVG(C)->X (R) =??
Sorting Example: Sorting 5 6 R1 := τ L (R2). L is a list of some of the attributes of R2. R1 is the list of tuples of R2 sorted first on the value of the first attribute on L, then on the second attribute
More informationDatabases 1. Defining Tables, Constraints
Databases 1 Defining Tables, Constraints DBMS 2 Rest of SQL Defining a Database Schema Primary Keys, Foreign Keys Local and Global Constraints Defining Views Triggers 3 Defining a Database Schema A database
More informationChapter 10 Advanced topics in relational databases
Chapter 10 Advanced topics in relational databases Security and user authorization in SQL Recursion in SQL Object-relational model 1. User-defined types in SQL 2. Operations on object-relational data Online
More informationInstructor: Jinze Liu. Fall 2008
Instructor: Jinze Liu Fall 2008 http://www.securityfocus.com/news/11455 Jinze Liu @ University of Kentucky 9/22/2008 2 Source: http://www.gocsi.com/ Database Security - Farkas 3 Almost all corporate/organizational
More informationIntroduction to SQL. Multirelation Queries Subqueries. Slides are reused by the approval of Jeffrey Ullman s
Introduction to SQL Multirelation Queries Subqueries Slides are reused by the approval of Jeffrey Ullman s 1 Our Running Example All our SQL queries will be based on the following database schema. Underline
More informationConstraints, Views & Indexes. Running Example. Kinds of Constraints INTEGRITY CONSTRAINTS. Keys Foreign key or referential integrity constraints
2 Constraints, Views & Indexes Introduction to databases CSCC43 Winter 2012 Ryan Johnson INTEGRITY CONSTRAINTS Thanks to Manos Papagelis, John Mylopoulos, Arnold Rosenbloom and Renee Miller for material
More informationSQL Continued! Outerjoins, Aggregations, Grouping, Data Modification
SQL Continued! Outerjoins, Aggregations, Grouping, Data Modification 1 Outerjoins R OUTER JOIN S is the core of an outerjoin expression. It is modified by: 1. Optional NATURAL in front of OUTER. 2. Optional
More informationIntroduction to SQL. Select-From-Where Statements Multirelation Queries Subqueries. Slides are reused by the approval of Jeffrey Ullman s
Introduction to SQL Select-From-Where Statements Multirelation Queries Subqueries Slides are reused by the approval of Jeffrey Ullman s 1 Why SQL? SQL is a very-high-level language. Say what to do rather
More informationEXTENDED RELATIONAL ALGEBRA OUTERJOINS, GROUPING/AGGREGATION INSERT/DELETE/UPDATE
More SQL EXTENDED RELATIONAL ALGEBRA OUTERJOINS, GROUPING/AGGREGATION INSERT/DELETE/UPDATE 1 The Extended Algebra δ = eliminate duplicates from bags. τ = sort tuples. γ = grouping and aggregation. Outerjoin
More informationINDEXES MICHAEL LIUT DEPARTMENT OF COMPUTING AND SOFTWARE MCMASTER UNIVERSITY
INDEXES MICHAEL LIUT (LIUTM@MCMASTER.CA) DEPARTMENT OF COMPUTING AND SOFTWARE MCMASTER UNIVERSITY SE 3DB3 (Slides adapted from Dr. Fei Chiang) Fall 2016 An Index 2 Data structure that organizes records
More informationMore SQL. Extended Relational Algebra Outerjoins, Grouping/Aggregation Insert/Delete/Update
More SQL Extended Relational Algebra Outerjoins, Grouping/Aggregation Insert/Delete/Update 1 The Extended Algebra δ = eliminate duplicates from bags. τ = sort tuples. γ = grouping and aggregation. Outerjoin
More informationChapter 6 The database Language SQL as a tutorial
Chapter 6 The database Language SQL as a tutorial About SQL SQL is a standard database language, adopted by many commercial systems. ANSI SQL, SQL-92 or SQL2, SQL99 or SQL3 extends SQL2 with objectrelational
More informationIntroduction to SQL. Select-From-Where Statements Multirelation Queries Subqueries
Introduction to SQL Select-From-Where Statements Multirelation Queries Subqueries 122 Why SQL? SQL is a very-high-level language. Say what to do rather than how to do it. Database management system figures
More informationIntroduction to SQL SELECT-FROM-WHERE STATEMENTS SUBQUERIES DATABASE SYSTEMS AND CONCEPTS, CSCI 3030U, UOIT, COURSE INSTRUCTOR: JAREK SZLICHTA
Introduction to SQL SELECT-FROM-WHERE STATEMENTS MULTIRELATION QUERIES SUBQUERIES 1 SQL SQL is a standard language for accessing databases. SQL stands for Structured Query Language. SQL lecture s material
More informationSQL DATA DEFINITION LANGUAGE
SQL DATA DEFINITION LANGUAGE DATABASE SCHEMAS IN SQL SQL is primarily a query language, for getting information from a database. DML: Data Manipulation Language SFWR ENG 3DB3 FALL 2016 MICHAEL LIUT (LIUTM@MCMASTER.CA)
More informationSQL DATA DEFINITION LANGUAGE
9/27/16 DATABASE SCHEMAS IN SQL SQL DATA DEFINITION LANGUAGE SQL is primarily a query language, for getting information from a database. SFWR ENG 3DB3 FALL 2016 But SQL also includes a data-definition
More informationConstraints. Local and Global Constraints Triggers
Constraints Foreign Keys Local and Global Constraints Triggers 1 Constraints and Triggers A constraint is a relationship among data elements that the DBMS is required to enforce. Example: key constraints.
More informationChapter 2 The relational Model of data. Relational model introduction
Chapter 2 The relational Model of data Relational model introduction 1 Contents What is a data model? Basics of the relational model Next : How to define? How to query? Constraints on relations 2 What
More informationSQL DATA DEFINITION LANGUAGE
SQL DATA DEFINITION LANGUAGE DATABASE SCHEMAS IN SQL SQL is primarily a query language, for getting information from a database. DML: Data Manipulation Language SFWR ENG 3DB3 FALL 2016 MICHAEL LIUT (LIUTM@MCMASTER.CA)
More informationCS54100: Database Systems
CS54100: Database Systems SQL DDL 27 January 2012 Prof. Chris Clifton Defining a Database Schema CREATE TABLE name (list of elements). Principal elements are attributes and their types, but key declarations
More informationSQL: Data Definition Language
SQL: Data Definition Language CSC 343 Winter 2018 MICHAEL LIUT (MICHAEL.LIUT@UTORONTO.CA) DEPARTMENT OF MATHEMATICAL AND COMPUTATIONAL SCIENCES UNIVERSITY OF TORONTO MISSISSAUGA Database Schemas in SQL
More informationChapter 6 The database Language SQL as a tutorial
Chapter 6 The database Language SQL as a tutorial About SQL SQL is a standard database language, adopted by many commercial systems. ANSI SQL, SQL-92 or SQL2, SQL99 or SQL3 extends SQL2 with objectrelational
More informationLikesèdrinker, beerè. Sellsèbar, beer, priceè. Frequentsèdrinker, barè
Modication to Views Via Triggers Oracle allows us to ëintercept" a modication to a view through an instead-of trigger Example Likesèdrinker, beerè Sellsèbar, beer, priceè Frequentsèdrinker, barè CREATE
More informationWhy SQL? SQL is a very-high-level language. Database management system figures out best way to execute query
Basic SQL Queries 1 Why SQL? SQL is a very-high-level language Say what to do rather than how to do it Avoid a lot of data-manipulation details needed in procedural languages like C++ or Java Database
More informationDatabases-1 Lecture-01. Introduction, Relational Algebra
Databases-1 Lecture-01 Introduction, Relational Algebra Information, 2018 Spring About me: Hajas Csilla, Mathematician, PhD, Senior lecturer, Dept. of Information Systems, Eötvös Loránd University of Budapest
More informationCSC 343 Winter SQL: Aggregation, Joins, and Triggers MICHAEL LIUT
SQL: Aggregation, Joins, and Triggers CSC 343 Winter 2018 MICHAEL LIUT (MICHAEL.LIUT@UTORONTO.CA) DEPARTMENT OF MATHEMATICAL AND COMPUTATIONAL SCIENCES UNIVERSITY OF TORONTO MISSISSAUGA Aggregation Operators
More informationCSCI3030U Database Models
CSCI3030U Database Models CSCI3030U RELATIONAL MODEL SEMISTRUCTURED MODEL 1 Content Design of databases. relational model, semistructured model. Database programming. SQL, XPath, XQuery. Not DBMS implementation.
More informationSQL: Data Manipulation Language
SQL: Data Manipulation Language CSC 343 Winter 2018 MICHAEL LIUT (MICHAEL.LIUT@UTORONTO.CA) DEPARTMENT OF MATHEMATICAL AND COMPUTATIONAL SCIENCES UNIVERSITY OF TORONTO MISSISSAUGA Why SQL? SQL is a very-high-level
More informationConstraints and Triggers
Constraints 1 Constraints and Triggers A constraint is a relationship among data elements that the DBMS is required to enforce Example: key constraints Triggers are only executed when a specified condition
More informationChapter 7: Constraints and Triggers. Foreign Keys Local and Global Constraints Triggers
Chapter 7: Constraints and Triggers Foreign Keys Local and Global Constraints Triggers 27 Constraints and Triggers! A constraint is a relationship among data elements that the DBMS is required to enforce.!
More informationSubqueries. Must use a tuple-variable to name tuples of the result
Subqueries A parenthesized SELECT-FROM-WHERE statement (subquery) can be used as a value in a number of places, including FROM and WHERE clauses Example: in place of a relation in the FROM clause, we can
More informationDatabase Design and Programming
Database Design and Programming Jan Baumbach jan.baumbach@imada.sdu.dk http://www.baumbachlab.net Example: EXISTS Set of beers with the same manf as b1, but not the same beer SELECT name FROM Beers b1
More informationCS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen
CS 464/564 Introduction to Database Management System Instructor: Abdullah Mueen LECTURE 12: CONSTRAINTS IN SQL Constraints Foreign Keys Local and Global Constraints Triggers 2 Constraints and Triggers
More informationCS145 Introduction. About CS145 Relational Model, Schemas, SQL Semistructured Model, XML
CS145 Introduction About CS145 Relational Model, Schemas, SQL Semistructured Model, XML 1 Content of CS145 Design of databases. E/R model, relational model, semistructured model, XML, UML, ODL. Database
More informationFrom E/R Diagrams to Relations
From E/R Diagrams to Relations Entity set relation Attributes attributes Relationships relations whose attributes are only: The keys of the connected entity sets Attributes of the relationship itself 1
More informationCS54100: Database Systems
CS54100: Database Systems Data Modeling 13 January 2012 Prof. Chris Clifton Main categories of data models Logical models: used to describe, organize and access data in DBMS; application programs refers
More informationMost database operations involve On- Line Transaction Processing (OTLP).
Data Warehouse 1 Data Warehouse Most common form of data integration. Copy data from one or more sources into a single DB (warehouse) Update: periodic reconstruction of the warehouse, perhaps overnight.
More informationOn-Line Application Processing
On-Line Application Processing WAREHOUSING DATA CUBES DATA MINING 1 Overview Traditional database systems are tuned to many, small, simple queries. Some new applications use fewer, more time-consuming,
More informationCS 317/387. A Relation is a Table. Schemas. Towards SQL - Relational Algebra. name manf Winterbrew Pete s Bud Lite Anheuser-Busch Beers
CS 317/387 Towards SQL - Relational Algebra A Relation is a Table Attributes (column headers) Tuples (rows) name manf Winterbrew Pete s Bud Lite Anheuser-Busch Beers Schemas Relation schema = relation
More informationWarehousing. Data Mining
On Line Application Processing Warehousing Data Cubes Data Mining 1 Overview Traditional database systems are tuned to many, small, simple queries. Some new applications use fewer, more timeconsuming,
More informationEntity-Relationship Model. Purpose of E/R Model
Entity-Relationship Model Slides adapted from http://infolab.stanford.edu/~ullman/fcdb.html 1 Purpose of E/R Model The E/R model allows us to sketch database schema designs. Includes some constraints,
More informationCSCD43: Database Systems Technology. Lecture 4
CSCD43: Database Systems Technology Lecture 4 Wael Aboulsaadat Acknowledgment: these slides are based on Prof. Garcia-Molina & Prof. Ullman slides accompanying the course s textbook. Steps in Database
More informationSchedule. Today: Feb. 21 (TH) Feb. 28 (TH) Feb. 26 (T) Mar. 5 (T) Read Sections , Project Part 6 due.
Schedule Today: Feb. 21 (TH) Transactions, Authorization. Read Sections 8.6-8.7. Project Part 5 due. Feb. 26 (T) Datalog. Read Sections 10.1-10.2. Assignment 6 due. Feb. 28 (TH) Datalog and SQL Recursion,
More informationA tuple is dangling if it doesn't join with any
Outerjoin R./ S = R./Swith dangling tuples padded with nulls and included in the result. A tuple is dangling if it doesn't join with any other tuple. R = A B 1 2 3 4 S = B C 2 5 2 6 7 8 R./ S = A B C 1
More informationENTITY-RELATIONSHIP MODEL
Assigned reading: Chapter 4 ENTITY-RELATIONSHIP MODEL Lecture 1 Relational database model Used by all major commercial database systems Very simple model Query with high-level languages: simple yet expressive
More informationtypes, but key declarations and constraints Similar CREATE X commands for other schema ëdrop X name" deletes the created element of beer VARCHARè20è,
Dening a Database Schema CREATE TABLE name èlist of elementsè. Principal elements are attributes and their types, but key declarations and constraints also appear. Similar CREATE X commands for other schema
More informationEntity-Relationship Model
Entity-Relationship Model 1 Purpose of E/R Model The E/R model allows us to sketch database schema designs Includes some constraints, but not operations Designs are pictures called entity-relationship
More informationSecurity and Authorization
Security and Authorization Sub-sets of SQL Data retrieval: SELECT Data Manipulation Language (DML): INSERT, UPDATE, DELETE Data Definition Language (DDL): CREATE, ALTER, DROP, RENAME Transaction control:
More informationDesign Techniques. 1. Avoid redundancy 2. Limit the use of weak entity sets 3. Don t use an entity set when an attribute will do
Design Techniques 1. Avoid redundancy 2. Limit the use of weak entity sets 3. Don t use an entity set when an attribute will do 1 Avoiding Redundancy Redundancy = saying the same thing in two (or more)
More informationDatabase System Concepts"
Database System Concepts! Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use " Database System Concepts" User Interfaces and Tools! Web Interfaces to Databases! Web Fundamentals!
More informationDebapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata
SQL 4 Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata Slides re-used, with minor modification, from Silberschatz, Korth and Sudarshan www.db-book.com Outline Join Expressions Views
More informationDatabase Security Lecture 10
Database Security Lecture 10 Database security Grant-Revoke Model Elisa Bertino bertino@cs.purdue.edu Access Control in Commercial DBMSs Most commercial systems adopt DAC Current discretionary authorization
More informationCOSC 304 Introduction to Database Systems. Views and Security. Dr. Ramon Lawrence University of British Columbia Okanagan
COSC 304 Introduction to Database Systems Views and Security Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Views A view is a named query that is defined in the database.
More informationSQL. The Basics Advanced Manipulation Constraints Authorization 1. 1
SQL The Basics Advanced Manipulation Constraints Authorization 1. 1 Table of Contents SQL 0 Table of Contents 0/1 Parke Godfrey 0/2 Acknowledgments 0/3 SQL: a standard language for accessing databases
More informationRelational Query Languages
Relational Query Languages Query languages: Allow manipulation and retrieval of data from a database. Relational model supports simple, powerful, declarative QLs with precise semantics: Strong formal foundation
More informatione e Conceptual design begins with the collection of requirements and results needed from the database (ER Diag.)
Instructor: Jinze Liu Fall 2008 Phases of Database Design Data Requirements e e Conceptual design begins with the collection of requirements and results needed from the database (ER Diag.) Conceptual Design
More informationRelational Algebra and SQL. Basic Operations Algebra of Bags
Relational Algebra and SQL Basic Operations Algebra of Bags 1 What is an Algebra Mathematical system consisting of: Operands --- variables or values from which new values can be constructed. Operators
More informationCreating Tables, Defining Constraints. Rose-Hulman Institute of Technology Curt Clifton
Creating Tables, Defining Constraints Rose-Hulman Institute of Technology Curt Clifton Outline Data Types Creating and Altering Tables Constraints Primary and Foreign Key Constraints Row and Tuple Checks
More informationChapter 1 SQL and Data
Chapter 1 SQL and Data What is SQL? Structured Query Language An industry-standard language used to access & manipulate data stored in a relational database E. F. Codd, 1970 s IBM 2 What is Oracle? A relational
More informationOutline. CS 235: Introduction to Databases. DB Application Programming. Interface Solutions. Basic PSM Form. Persistent Stored Modules
Outline CS 235: Introduction to Databases Svetlozar Nestorov Database application programming SQL limitations SQL Persistent, Stored Modules (PSM) Extension of SQL PL/SQL: Oracle s version of PSM Lecture
More informationE/R Diagrams! Converting E/R Diagrams to Relations!
E/R Diagrams! Converting E/R Diagrams to Relations! DB design is a serious and possibly complex business.! A client may know they want a database, but they donʼt know what they want in it or how it should
More informationSQL Functionality SQL. Creating Relation Schemas. Creating Relation Schemas
SQL SQL Functionality stands for Structured Query Language sometimes pronounced sequel a very-high-level (declarative) language user specifies what is wanted, not how to find it number of standards original
More informationBeersèname, manfè. Likesèdrinker, beerè. Sellsèbar, beer, priceè. Frequentsèdrinker, barè
SQL Queries Principal form: SELECT desired attributes FROM tuple variables range over relations WHERE condition about t.v.'s; Running example relation schema: Beersèname, manfè Barsèname, addr, licenseè
More informationRelational Algebra. Algebra of Bags
Relational Algebra Basic Operations Algebra of Bags What is an Algebra Mathematical system consisting of: Operands --- variables or values from which new values can be constructed. Operators --- symbols
More informationContains slides made by Naci Akkøk, Pål Halvorsen, Arthur M. Keller, Vera Goebel
SQL-99 Contains slides made by Naci Akkøk, Pål Halvorsen, Arthur M. Keller, Vera Goebel SQL-99 user-defined types (UDTs) methods for UDTs declarations references operations Overview 2 SQL Development SQL-86
More informationAnnouncements (September 21) SQL: Part III. Triggers. Active data. Trigger options. Trigger example
Announcements (September 21) 2 SQL: Part III CPS 116 Introduction to Database Systems Homework #2 due next Thursday Homework #1 sample solution available today Hardcopies only Check the handout box outside
More informationLogical Query Languages. Motivation: 1. Logical rules extend more naturally to. recursive queries than does relational algebra. Used in SQL recursion.
Logical Query Languages Motivation: 1. Logical rules extend more naturally to recursive queries than does relational algebra. Used in SQL recursion. 2. Logical rules form the basis for many information-integration
More informationConceptual Design with ER Model
Conceptual Design with ER Model Lecture #2 1/24/2012 Jeff Ballard CS564, Spring 2014, Database Management Systems 1 See the Moodle page Due February 7 Groups of 2-3 people Pick a team name Homework 1 is
More informationViews. COSC 304 Introduction to Database Systems. Views and Security. Creating Views. Views Example. Removing Views.
COSC 304 Introduction to Database Systems Views and Security Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Views A view is a named query that is defined in the database.
More informationThe Relational Model
The Relational Model CS 317, Fall 2007 Course outline Weeks 1 7: Relational Data Models E/R models. Weeks 1 3. The relational model. Next 4 weeks. Convert E/R to relational schemas. Functional and multi
More informationDatabase Security Overview. Murat Kantarcioglu
UT DALLAS Erik Jonsson School of Engineering & Computer Science Database Security Overview Murat Kantarcioglu Topics The access control model of System R Extensions to the System R model Views and content-based
More informationTextbook: Chapter 4. Chapter 5: Intermediate SQL. CS425 Fall 2016 Boris Glavic. Chapter 5: Intermediate SQL. View Definition.
Chapter 5: Intermediate SQL Views CS425 Fall 2013 Boris Glavic Chapter 5: Intermediate SQL Transactions Integrity Constraints SQL Data Types and Schemas Access Control Textbook: Chapter 4 5.2 Views View
More informationDatabases 1. SQL/PSM and Oracle PL/SQL
Databases 1 SQL/PSM and Oracle PL/SQL SQL DDL (Data Definition Language) Defining a Database Schema Primary Keys, Foreign Keys Local and Global Constraints Defining Views Triggers 2 SQL DML (Database Modifications)
More informationDebapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata
SQL 3 Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata Slides re-used, with minor modification, from Silberschatz, Korth and Sudarshan www.db-book.com Outline Join Expressions Views
More informationRelational Algebra BASIC OPERATIONS DATABASE SYSTEMS AND CONCEPTS, CSCI 3030U, UOIT, COURSE INSTRUCTOR: JAREK SZLICHTA
Relational Algebra BASIC OPERATIONS 1 What is an Algebra Mathematical system consisting of: Operands -- values from which new values can be constructed. Operators -- symbols denoting procedures that construct
More informationDatabase Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.
Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 13 Constraints & Triggers Hello and welcome to another session
More informationI Relational Database Modeling how to define
I Relational Database Modeling how to define Relational Model data structure, operations, constraints Design theory for relational database High-level Models E/R model, UML model, ODL II Relational Database
More informationCS425 Fall 2017 Boris Glavic Chapter 5: Intermediate SQL
CS425 Fall 2017 Boris Glavic Chapter 5: Intermediate SQL modified from: Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 5: Intermediate SQL Views Transactions Integrity
More informationI Relational Database Modeling how to define
I Relational Database Modeling how to define Relational Model data structure, operations, constraints Design theory for relational database High-level Models E/R model, UML model, ODL II Relational Database
More informationChapter 4: Intermediate SQL
Chapter 4: Intermediate SQL Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 4: Intermediate SQL Join Expressions Views Transactions Integrity Constraints SQL Data
More informationDesign Theory for Relational Databases
By Marina Barsky Design Theory for Relational Databases Lecture 15 Functional dependencies: formal definition X Y is an assertion about a relation R that whenever two tuples of R agree on all the attributes
More informationSQL: Concepts. Todd Bacastow IST 210: Organization of Data 2/17/ IST 210
SQL: Concepts Todd Bacastow IST 210: Organization of Data 2/17/2004 1 Design questions How many entities are there? What are the major entities? What are the attributes of each entity? Is there a unique
More informationDatabase Programming with PL/SQL
Database Programming with PL/SQL 9-5 Objectives This lesson covers the following objectives: List and explain several object privileges Explain the function of the EXECUTE object privilege Write SQL statements
More informationCSE 565 Computer Security Fall 2018
CSE 565 Computer Security Fall 2018 Lecture 12: Database Security Department of Computer Science and Engineering University at Buffalo 1 Review of Access Control Types We previously studied four types
More informationSQL: Part III. Announcements. Constraints. CPS 216 Advanced Database Systems
SQL: Part III CPS 216 Advanced Database Systems Announcements 2 Reminder: Homework #1 due in 12 days Reminder: reading assignment posted on Web Reminder: recitation session this Friday (January 31) on
More informationCS W Introduction to Databases Spring Computer Science Department Columbia University
CS W4111.001 Introduction to Databases Spring 2018 Computer Science Department Columbia University 1 in SQL 1. Key constraints (PRIMARY KEY and UNIQUE) 2. Referential integrity constraints (FOREIGN KEY
More informationRunning Example Tables name location
Running Example Pubs-Drinkers-DB: The data structures of the relational model Attributes and domains Relation schemas and database schemas databases Pubs (name, location) Drinkers (name, location) Sells
More informationChapter 2 The relational Model of data. Relational algebra
Chapter 2 The relational Model of data Relational algebra 1 Contents What is a data model? Basics of the relational model How to define? How to query? Constraints on relations 2 An algebraic query language
More informationPhysical Design. Elena Baralis, Silvia Chiusano Politecnico di Torino. Phases of database design D B M G. Database Management Systems. Pag.
Physical Design D B M G 1 Phases of database design Application requirements Conceptual design Conceptual schema Logical design ER or UML Relational tables Logical schema Physical design Physical schema
More information1 Relational Data Model
Prof. Dr.-Ing. Wolfgang Lehner INTELLIGENT DATABASE GROUP 1 Relational Data Model What is in the Lecture? 1. Database Usage Query Programming Design 2 Relational Model 3 The Relational Model The Relation
More informationOuterjoins, Constraints, Triggers
Outerjoins, Constraints, Triggers Lecture #13 Autumn, 2001 Fa, 2001, LRX #13 Outerjoins, Constraints, Triggers HUST,Wuhan,China 358 Outerjoin R S = R S with danging tupes padded with nus and incuded in
More informationThe Relational Model. Chapter 3. Comp 521 Files and Databases Fall
The Relational Model Chapter 3 Comp 521 Files and Databases Fall 2012 1 Why Study the Relational Model? Most widely used model by industry. IBM, Informix, Microsoft, Oracle, Sybase, etc. It is simple,
More informationPostgreSQL Documentation. Fast Backward
Prev Fast Backward PostgreSQL 7.4.1 Documentation Fast Forward Next GRANT Name GRANT -- define access privileges Synopsis GRANT { { SELECT INSERT UPDATE DELETE RULE REFERENCES TRIGGER } [,...] ALL [ PRIVILEGES
More informationAccess Control. Access control: ensures that all direct accesses to object are authorized a scheme for mapping users to allowed actions
Access Control 1 Access Control Access control: ensures that all direct accesses to object are authorized a scheme for mapping users to allowed actions Protection objects: system resources for which protection
More informationDatabase Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.
Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 5 Structured Query Language Hello and greetings. In the ongoing
More informationPolls on Piazza. Open for 2 days Outline today: Next time: "witnesses" (traditionally students find this topic the most difficult)
L04: SQL 124 Announcements! Polls on Piazza. Open for 2 days Outline today: - practicing more joins and specifying key and FK constraints - nested queries Next time: "witnesses" (traditionally students
More informationRecap and Schedule. Till Now: Today: Ø Query Languages: Relational Algebra; SQL. Ø Datalog A logical query language. Ø SQL Recursion.
Recap and Schedule Till Now: Ø Query Languages: Relational Algebra; SQL Today: Ø Datalog A logical query language. Ø SQL Recursion. CSE 532 DLog 1 Logical Query Languages Motivation: 1. Logical rules extend
More informationChapter 4: Intermediate SQL
Chapter 4: Intermediate SQL Chapter 4: Intermediate SQL Join Expressions Views Transactions Integrity Constraints SQL Data Types and Schemas Authorization Joined Relations Join operations take two relations
More information