Databázy (1) Prednáška 11. Alexander Šimko
|
|
- Wilfred Underwood
- 6 years ago
- Views:
Transcription
1 Databázy (1) Prednáška 11 Alexander Šimko
2 Contents I Aktualizovanie štruktúry databázy
3 Section 1 Aktualizovanie štruktúry databázy
4 Aktualizácia štruktúry databázy Štruktúra databázy sa vyvíja
5 Aktualizácia štruktúry databázy Čo s produkciou?
6 Aktualizácia štruktúry databázy ALTER TABLE
7 Premenovanie tabuľky ALTER TABLE názov_tabuľky RENAME TO nový_názov
8 Pridanie nového stĺpca ALTER TABLE názov_tabuľky ADD [COLUMN] definícia_stĺpca definícia_stĺpca ako pri CREATE TABLE
9 Pridanie nového stĺpca Čo existujúce riadky? DEFAULT hodnota NULL
10 Pridanie nového stĺpca Integritné obmedzenia Pozor!!! Existujúce riadky nemusia spĺňať integritné obmedzenia!
11 Pridanie nového stĺpca Integritné obmedzenia ALTER TABLE films ADD COLUMN length integer NOT NULL Ak tabuľka neobsahuje riadky, potom všetko zbehne Ak tabuľka obsahuje nejaké riadky, potom dostaneme chybu ERROR: column "length" contains null values
12 Zmazanie existujúceho stĺpca ALTER TABLE názov_tabuľky DROP [COLUMN] názov_stĺpca [CASCADE] CASCASE zmaže aj odkazujúce sa objekty
13 Premenovanie existujúceho stĺpca ALTER TABLE názov_tabuľky RENAME [COLUMN] názov_stĺpca TO nový_názov
14 Nastavenie novej DEFAULT hodnoty ALTER TABLE názov_tabuľky ALTER [COLUMN] názov_stĺpca SET DEFAULT výraz neberie ohľad na predchádzajúcu DEFAULT hodnotu
15 Zrušenie DEFAULT hodnoty ALTER TABLE názov_tabuľky ALTER [COLUMN] názov_stĺpca DROP DEFAULT
16 Zmena dátového typu stĺpca ALTER TABLE názov_tabuľky ALTER [COLUMN] názov_stĺpca [SET DATA] TYPE názov_typu
17 Zmena dátového typu stĺpca Čo s dátami?
18 Zmena dátového typu stĺpca Automatická konverzia dát integer varchar varchar(2) varchar(255)......
19 Zmena dátového typu stĺpca Konvertuje sa aj DEFAULT hodnota
20 Zmena dátového typu stĺpca vals key : varchar value : varchar length 20 height 67 ALTER TABLE vals ALTER COLUMN value SET DATA TYPE integer ERROR: column "value" cannot be cast automatically to type integer
21 Zmena dátového typu stĺpca ALTER TABLE názov_tabuľky ALTER [COLUMN] názov_stĺpca [SET DATA] TYPE názov_typu [USING nová_hodnota]
22 Zmena dátového typu stĺpca vals key : varchar value : varchar length 20 height 67 ALTER TABLE vals ALTER COLUMN value SET DATA TYPE integer USING value::integer vals key : varchar value : integer length 20 height 67
23 Zmena dátového typu stĺpca users id : serial name : varchar 1 johny 2 oz ALTER TABLE users ALTER COLUMN name SET DATA TYPE varchar(2) ERROR: value too long for type character varying(2)
24 Zmena dátového typu stĺpca users id : serial name : varchar 1 johny 2 oz ALTER TABLE users ALTER COLUMN name SET DATA TYPE varchar(2) USING left(name, 2) users id : serial name : varchar(2) 1 jo 2 oz
25 Zmena dátového typu stĺpca users id : serial name : varchar tel_number : integer 1 johny oz ALTER TABLE users ALTER COLUMN tel_number SET DATA TYPE varchar USING concat( +466, tel_number) users id : serial name : varchar tel_number : varchar 1 johny oz
26 Zmena dátového typu stĺpca USING sa môže odkazovať aj na iné stĺpce
27 Zmena dátového typu stĺpca A čo DEFAULT hodnota?
28 Zmena dátového typu stĺpca Tá sa použitím USING nekonvertuje
29 Zmena dátového typu stĺpca ALTER TABLE users ALTER COLUMN tel_number DROP DEFAULT; ALTER TABLE users ALTER COLUMN tel_number SET DATA TYPE varchar USING concat( +466, tel_number); ALTER TABLE users ALTER COLUMN tel_number SET DEFAULT ;
30 Pridanie integritného obmedzenia NOT NULL ALTER TABLE názov_tabuľky ALTER [ COLUMN ] názov_stĺpca SET NOT NULL
31 Pridanie integritného obmedzenia NOT NULL NULL hodnoty v existujúcich riadkoch vedú na chybu integritné obmedzenie sa nevytvorí
32 Odstránenie integritného obmedzenia NOT NULL ALTER TABLE názov_tabuľky ALTER [ COLUMN ] názov_stĺpca DROP NOT NULL
33 Pridanie ostatných integritných obmedzení ALTER TABLE názov_tabuľky ADD definícia_integritného_obmedzenia kde definícia_integritného_obmedzenia je [CONSTRAINT názov] UNIQUE (...) [CONSTRAINT názov] CHECK (...) [CONSTRAINT názov] PRIMARY KEY (...) [CONSTRAINT názov] FOREIGN KEY (...) REFERENCES...
34 Pridanie ostatných integritných obmedzení Ak dáta porušujú integritné obmedzenie, tak nie je pridané
35 Premenovanie existujúceho integritného obmedzenia ALTER TABLE názov_tabuľky RENAME CONSTRAINT názov_obmedzenia TO nový_názov
36 Odstránenie existujúceho integritného obmedzenia ALTER TABLE názov_obmedzenia DROP CONSTRAINT názov_obmedzenia
37 ALTER script postupnosť poväčšine ALTER príkazov, ktoré docielia požadovanú zmenu štruktúry databázy
38 Komplexný príklad films id : serial name : varchar director : varchar price : numeric chceme zmeniť na films id : serial name : varchar director_id : integer price : numeric persons id : serial name : varchar
39 Komplexný príklad CREATE TABLE persons ( id serial, name varchar ); INSERT INTO persons (name) SELECT DISTINCT director FROM films;
40 Komplexný príklad ALTER TABLE films ALTER COLUMN director SET DATA TYPE integer USING (SELECT id FROM persons WHERE name = director);
41 Komplexný príklad Toto žiaľ neide. USING nepodporuje vnorené SELECTy.
42 Komplexný príklad ALTER TABLE films ADD COLUMN director_id integer; UPDATE films AS f SET director_id = (SELECT p.id FROM persons AS p WHERE p.name = f.director);
43 Komplexný príklad ALTER TABLE films DROP COLUMN director;
44 Koniec Koniec
Jazyk SQL. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)
Jazyk SQL Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) 2011-2016 Jazyk SQL - Structured Query Language SQL je počítačový jazyk určený na komunikáciu s relačným SRBD neprocedurálny (deklaratívny) jazyk
More informationDatabázy (1) Prednáška 08. Alexander Šimko
Databázy (1) Prednáška 08 Alexander Šimko simko@fmph.uniba.sk Contents I Subqueries (poddopyty) konštrukcia WITH Section 1 Subqueries (poddopyty) Subquery (poddopyt) Použitie SELECTu na mieste, kde sme
More informationDatabázové systémy. SQL Window functions
Databázové systémy SQL Window functions Scores Tabuľka s bodmi pre jednotlivých študentov id, name, score Chceme ku každému doplniť rozdiel voči priemeru 2 Demo data SELECT * FROM scores ORDER BY score
More informationVYLEPŠOVANIE KONCEPTU TRIEDY
VYLEPŠOVANIE KONCEPTU TRIEDY Typy tried class - definuje premenné a metódy (funkcie). Ak nie je špecifikovaná inak, viditeľnosť členov je private. struct - definuje premenné a metódy (funkcie). Ak nie
More informationPoradové a agregačné window funkcie. ROLLUP a CUBE
Poradové a agregačné window funkcie. ROLLUP a CUBE 1) Poradové a agregačné window funkcie 2) Extrémy pomocou DENSE_RANK(), TOP() - Príklady 3) Spriemernené poradia 4) Kumulatívne súčty 5) Group By a Datepart,
More informationDatabázy (2) Prednáška 03. Alexander Šimko
Databázy (2) Prednáška 03 Alexander Šimko simko@fmph.uniba.sk Contents I Databázové transakcie Section 1 Databázové transakcie Transakcie Transakcia je postupnosť príkazov, ktoré vystupujú ako celok Databázové
More informationdoc. RNDr. Tomáš Skopal, Ph.D. RNDr. Michal Kopecký, Ph.D.
course: Database Systems (NDBI025) SS2017/18 doc. RNDr. Tomáš Skopal, Ph.D. RNDr. Michal Kopecký, Ph.D. Department of Software Engineering, Faculty of Mathematics and Physics, Charles University in Prague
More information1 Vytvorenie tabuľky
Základy jazyka SQL (Structured Query Language) - vyvinula IBM začiatkom 70-tych rokov - je to deklaratívny jazyk (popisuje čo urobiť, nie ako) - je súčasťou veľkých databázových systémov (Informix, Oracle,
More informationRecipient Configuration. Štefan Pataky MCP, MCTS, MCITP
Recipient Configuration Štefan Pataky MCP, MCTS, MCITP Agenda Mailbox Mail Contact Distribution Groups Disconnected Mailbox Mailbox (vytvorenie nového účtu) Exchange Management Console New User Exchange
More informationSpájanie tabuliek. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)
Spájanie tabuliek Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) 2011-2016 Úvod pri normalizácii rozdeľujeme databázu na viacero tabuliek prepojených cudzími kľúčmi SQL umožňuje tabuľky opäť spojiť
More informationPL/SQL - procedurálny jazyk
PL/SQL - procedurálny jazyk Dátové typy ZNAKOVÉ DÁTOVÉ TYPY --- CHAR, NCHAR, VARCHAR2, NVARCHAR2 + LONG CHAR(dĺžka) [BYTE CHAR] Parameter dĺžka je z intervalu 1-2000. Slúži na reťazec pevnej dĺžky. NCHAR(dĺžka)
More informationDatabázy (2) Prednáška 08. Alexander Šimko
Databázy (2) Prednáška 08 Alexander Šimko simko@fmph.uniba.sk Contents I Funkcie Zložené typy PL/pgSQL Agregačné funkcie Funkcie Section 1 Funkcie Funkcie PostgreSQL umožňuje vytvoriť si vlastné databázové
More informationIntroduction. Sample Database SQL-92. Sample Data. Sample Data. Chapter 6 Introduction to Structured Query Language (SQL)
Chapter 6 Introduction to Structured Query Language (SQL) Introduction Structured Query Language (SQL) is a data sublanguage that has constructs for defining and processing a database It can be Used stand-alone
More informationUnit 1 - Chapter 4,5
Unit 1 - Chapter 4,5 CREATE DATABASE DatabaseName; SHOW DATABASES; USE DatabaseName; DROP DATABASE DatabaseName; CREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype,... columnn
More informationNormalizácia a normálne formy
Normalizácia a normálne formy normalizácia je proces, pomocou ktorého sa dá databáza zbaviť štrukturálnych vád normalizácie je súhrnom niekoľkých tzv. normálnych foriem - množín pravidiel, ktoré hovoria
More informationSQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3
B0B36DBS, BD6B36DBS: Database Systems h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3 SQL: Data De ni on Mar n Svoboda mar n.svoboda@fel.cvut.cz 13. 3. 2018 Czech Technical University
More informationkucharka exportu pro 9FFFIMU
požiadavky na export kodek : Xvid 1.2.1 stable (MPEG-4 ASP) // výnimočne MPEG-2 bitrate : max. 10 Mbps pixely : štvorcové (Square pixels) rozlíšenie : 1920x1080, 768x432 pre 16:9 // výnimočne 1440x1080,
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 informationData Reference Searcher. Documentation
Documentation Martin Dráb 8/19/2010 TABLE OF CONTENT Table of content... 1 Basic information... 2 Supported versions of Microsoft Dynamics AX... 2 Supported languages... 2 Installation... 3 User guide...
More informationD B M G. SQL language: basics. Managing tables. Creating a table Modifying table structure Deleting a table The data dictionary Data integrity
SQL language: basics Creating a table Modifying table structure Deleting a table The data dictionary Data integrity 2013 Politecnico di Torino 1 Creating a table Creating a table (1/3) The following SQL
More informationDatabase Systems. Bence Molnár
Database Systems Bence Molnár SQL History Beginning of 70s IBM SEQUEL (Structured English QUery Language) Structured/Standard Query Language In 1986 ANSI, 1987 ISO standard SQL2 ('92), SQL3 ('99),... Development
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 informationSQL Data Definition and Data Manipulation Languages (DDL and DML)
.. Cal Poly CPE/CSC 365: Introduction to Database Systems Alexander Dekhtyar.. SQL Data Definition and Data Manipulation Languages (DDL and DML) Note: This handout instroduces both the ANSI SQL synatax
More informationGroup ID: Names: Score: / 100 CS122A HW2
Group ID: Names: Score: / 100 CS122A HW2 Since Maintenance Engineer, Pilot, Flight Attendant, and Operation Staff COVER Employee, we don t need to create a separate Employee table. Stores MaintenanceEngineer
More information2. E/R Design Considerations
2. E/R Design Considerations 32 What you will learn in this section Relationships cont d: multiplicity, multi-way Design considerations Conversion to SQL 33 Multiplicity of E/R Relationships Multiplicity
More informationFull file at
SQL for SQL Server 1 True/False Questions Chapter 2 Creating Tables and Indexes 1. In order to create a table, three pieces of information must be determined: (1) the table name, (2) the column names,
More informationCOSC 304 Introduction to Database Systems SQL DDL. Dr. Ramon Lawrence University of British Columbia Okanagan
COSC 304 Introduction to Database Systems SQL DDL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Overview Structured Query Language or SQL is the standard query language
More informationDatabase Management Systems
Sample Questions 1 Write SQL query to create a table for describing a book. The table should have Book Title, Author, Publisher, Year published, and ISBN fields. Your table should have a primary key. For
More informationAlper VAHAPLAR
Alper VAHAPLAR 2017 2018 DDL (Data Definition Language) Database and table creation, update and delete operations, DML (Data Manipulation Language) Data Entry, query, update and delete operations, DCL
More informationVnorené SQL. Autor prezentácie: Peter Šípoš
Vnorené SQL Autor prezentácie: Peter Šípoš Literatúra Programmatic SQL od Pearson Ed Embedded SQL: http://download.oracle. com/docs/cd/b10501_01/appdev.920/a97269/pc_06sql.htm Oracle Dynamic SQL: http://download.oracle.
More informationEvolving Database Design and Architecture Patterns and Practices
Evolving Database Design and Architecture Patterns and Practices Pramod Sadalage ThoughtWorks Inc. @pramodsadalage 1 Patterns of Database Changes 2 Patterns of Database Changes Architecture 2 Patterns
More informationCOSC344 Database Theory and Applications. Lecture 5 SQL - Data Definition Language. COSC344 Lecture 5 1
COSC344 Database Theory and Applications Lecture 5 SQL - Data Definition Language COSC344 Lecture 5 1 Overview Last Lecture Relational algebra This Lecture Relational algebra (continued) SQL - DDL CREATE
More informationMySQL by Examples for Beginners
yet another insignificant programming notes... HOME MySQL by Examples for Beginners Read "How to Install MySQL and Get Started" on how to install, customize, and get started with MySQL. 1. Summary of MySQL
More informationTvorba informačných systémov. 4. prednáška: Návrh IS
Tvorba informačných systémov 4. prednáška: Návrh IS Návrh informačného systému: témy Ciele návrhu ERD DFD Princípy OOP Objektová normalizácia SDD Architektonické pohľady UML diagramy Architektonické štýly
More informationThe "Parcels" Database Schema
The "Parcels" Database Schema These are the SQL statements needed to create the tables and indexes in the "Parcels" database (without the rows containing the data. DROP TABLE "PARCELS" CASCADE CONSTRAINTS;
More informationCOMP 430 Intro. to Database Systems
COMP 430 Intro. to Database Systems Multi-table SQL Get clickers today! Slides use ideas from Chris Ré and Chris Jermaine. The need for multiple tables Using a single table leads to repeating data Provides
More informationAnnouncements. Outline UNIQUE. (Inner) joins. (Inner) Joins. Database Systems CSE 414. WQ1 is posted to gradebook double check scores
Announcements Database Systems CSE 414 Lectures 4: Joins & Aggregation (Ch. 6.1-6.4) WQ1 is posted to gradebook double check scores WQ2 is out due next Sunday HW1 is due Tuesday (tomorrow), 11pm HW2 is
More informationuser specifies what is wanted, not how to find it
SQL 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 ANSI SQL updated
More informationIn this Lecture. More SQL Data Definition. Deleting Tables. Creating Tables. ALTERing Columns. Changing Tables. More SQL
In this Lecture Database Systems Lecture 6 Natasha Alechina More SQL DROP TABLE ALTER TABLE INSERT, UPDATE, and DELETE Data dictionary Sequences For more information Connolly and Begg chapters 5 and 6
More informationFull file at
ch2 True/False Indicate whether the statement is true or false. 1. The SQL command to create a database table is an example of DML. 2. A user schema contains all database objects created by a user. 3.
More information2. Týždeň MySQL - dátové typy a funkcie num. a reťazcové
2. Týždeň MySQL - dátové typy a funkcie num. a reťazcové 1. Prvky jazyka MySQL http://dev.mysql.com/doc/refman/5.7/en/language-structure.html 2. Typy a pretypovanie http://dev.mysql.com/doc/refman/5.7/en/data-types.html
More informationDB Creation with SQL DDL
DB Creation with SQL DDL Outline SQL Concepts Data Types Schema/Table/View Creation Transactions and Access Control Objectives of SQL Ideally, database language should allow user to: create the database
More informationSELECT Product.name, Purchase.store FROM Product JOIN Purchase ON Product.name = Purchase.prodName
Announcements Introduction to Data Management CSE 344 Lectures 5: More SQL aggregates Homework 2 has been released Web quiz 2 is also open Both due next week 1 2 Outline Outer joins (6.3.8, review) More
More informationChapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement
Chapter 4 Basic SQL Basic SQL SQL language Considered one of the major reasons for the commercial success of relational databases SQL Structured Query Language Statements for data definitions, queries,
More informationINTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION INFORMATICS PRACTICES WORKSHEET 15 TH CHAPTER DATABASE TRANSACTION IMPORTANT QUESTION
INTERNATIONAL INDIAN SCHOOL, RIYADH XI XII BOYS SECTION INFORMATICS PRACTICES WORKSHEET 15 TH CHAPTER DATABASE TRANSACTION Grade- XII IMPORTANT QUESTION 1. What is the benefit of Transaction? 2. What are
More informationCourse Outline and Objectives: Database Programming with SQL
Introduction to Computer Science and Business Course Outline and Objectives: Database Programming with SQL This is the second portion of the Database Design and Programming with SQL course. In this portion,
More information2.9 Table Creation. CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... )
2.9 Table Creation CREATE TABLE TableName ( AttrName AttrType, AttrName AttrType,... ) CREATE TABLE Addresses ( id INTEGER, name VARCHAR(20), zipcode CHAR(5), city VARCHAR(20), dob DATE ) A list of valid
More information1 Komplexný príklad využitia OOP
1 Komplexný príklad využitia OOP Najčastejším využitím webových aplikácií je komunikácia s databázovým systémom. Komplexný príklad je preto orientovaný práve do tejto oblasti. Od verzie PHP 5 je jeho domovskou
More informationCreating databases using SQL Server Management Studio Express
Creating databases using SQL Server Management Studio Express With the release of SQL Server 2005 Express Edition, TI students and professionals began to have an efficient, professional and cheap solution
More informationAplikačný dizajn manuál
Aplikačný dizajn manuál Úvod Aplikačný dizajn manuál je súbor pravidiel vizuálnej komunikácie. Dodržiavaním jednotných štandardov, aplikácií loga, písma a farieb pri prezentácii sa vytvára jednotný dizajn,
More informationRiešenia a technológie pre jednotnú správu používateľov
Riešenia a technológie pre jednotnú správu používateľov Radovan Semančík Agenda Úvod: Identity Crisis Technológie správy používateľov Postup nasadenia Záver Súčasný stav IT Security Nekonzistentné bezpečnostné
More informationCSC 261/461 Database Systems Lecture 10
CSC 261/461 Database Systems Lecture 10 Spring 2018 Please put away all electronic devices Announcements From now on, no electronic devices allowed during lecture Includes Phone and Laptop Why? For your
More informationREPORT DESIGNER 1 VYTVORENIE A ÚPRAVA FORMULÁRA. úprava formulárov v Money S4 / Money S Vytvorenie formulára
REPORT DESIGNER úprava formulárov v Money S4 / Money S5 Informačný systém Money S4/S5 umožňuje upraviť tlačové zostavy tak, aby plne vyhovovali potrebám používateľa. Na úpravu tlačových zostáv slúži doplnkový
More informationLast Name: Doe First Name: John Student ID:
Last Name: Doe First Name: John Student ID: 12345678 1. Functional dependencies and normal forms [65 pts] A. Poster_Incentive(pid, aid, incentive, total) [22 pts] (a) [10pts] List all of the functional
More informationChapter 4. Basic SQL. Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Chapter 4 Basic SQL Copyright 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries
More informationJSON Support in MariaDB
JSON Support in MariaDB Vicențiu Ciorbaru Software Engineer @ MariaDB Foundation * * JSON & GeoJSON JSON (Java Script Object Notation), a text based, platform independent data exchange format MariaDB Supports:
More informationFIGURE 1.0: TARGETED INCOMPLETE ERD. db2 => CREATE DATABASE EMPDB [PRESS ENTER & WAIT SUCCESSFUL MESSAGE]
DEPARTMENT STAFF PK DEPTID DEPTNAME has FK 1 STAFFID STAFFNAME DEPTID FIGURE 1.0: TARGETED INCOMPLETE ERD STEP 1: LAUNCH COMMAND LINE PROCESSOR (CLP) STEP 2: CRTE DATABASE IN COMMAND LINE PROCESSOR (CLP)
More informationCONSTRAINTS AND UPDATES CHAPTER 3 (6/E) CHAPTER 5 (5/E)
1 CONSTRAINTS AND UPDATES CHAPTER 3 (6/E) CHAPTER 5 (5/E) 3 LECTURE OUTLINE Constraints in Relational Databases Update Operations 4 SATISFYING INTEGRITY CONSTRAINTS Constraints are restrictions on the
More informationSQL: DDL. John Ortiz Cs.utsa.edu
SQL: DDL John Ortiz Cs.utsa.edu SQL Data Definition Language Used by DBA or Designer to specify schema A set of statements used to define and to change the definition of tables, columns, data types, constraints,
More informationCOMP 330: SQL 3. Chris Jermaine and Kia Teymourian Rice University
COMP 330: SQL 3 Chris Jermaine and Kia Teymourian Rice University 1 HAVING RATES (DRINKER, BEER, SCORE) Example: What is the highest rated beer, on average, considering only beers that have at least 10
More information1- a> [5pts] Create the new table by writing and executing a full SQL DDL statement based on the following schema:
1. [20pts] To track the history of financial information changes such as a driver s bank account, you are going to create a table to store the history of all bank account numbers. Once created, this table
More informationSample Relational Database
Sample Relational Database Student: Alexander Rudolf Gruber MNr: 9812938 Table of Contents 1 Database Schema:... 2 2 Practical implementation of the database with mysql... 3 3 Inserting Test Data with
More informationTutorial 2: Relational Modelling
Tutorial 2: Relational Modelling Informatics 1 Data & Analysis Week 4, Semester 2, 2014 2015 This worksheet has three parts: tutorial Questions, followed by some Examples and their Solutions. Before your
More informationPerceptive Intelligent Capture Visibility
Perceptive Intelligent Capture Visibility Upgrade Guide Version: 3.0.x Written by: Product Knowledge, R&D Date: September 2016 2015 Lexmark International Technology, S.A. All rights reserved. Lexmark is
More informationThe University of Nottingham
The University of Nottingham SCHOOL OF COMPUTER SCIENCE AND INFORMATION TECHNOLOGY A LEVEL 1 MODULE, SPRING SEMESTER 2006-2007 DATABASE SYSTEMS Time allowed TWO hours Candidates must NOT start writing
More informationIBM DB2 UDB V7.1 Family Fundamentals.
IBM 000-512 DB2 UDB V7.1 Family Fundamentals http://killexams.com/exam-detail/000-512 Answer: E QUESTION: 98 Given the following: A table containing a list of all seats on an airplane. A seat consists
More informationDraw an ER diagram that encodes the following business rules. Clearly mark all key and participation constraints.
CS 500, Fundamentals of Databases Midterm Exam Completed between February 16 th (9am) and February 18 th (11pm), 2018 SOLUTIONS Problem 1 (20 points): ER modeling Draw an ER diagram that encodes the following
More information.. Spring 2008 CSC 468: DBMS Implementation Alexander Dekhtyar..
.. Spring 2008 CSC 468: DBMS Implementation Alexander Dekhtyar.. Tuning Oracle Query Execution Performance The performance of SQL queries in Oracle can be modified in a number of ways: By selecting a specific
More informationDatabase Systems CSE 414
Database Systems CSE 414 Lectures 4: Joins & Aggregation (Ch. 6.1-6.4) 1 Announcements Should now have seats for all registered 2 Outline Inner joins (6.2, review) Outer joins (6.3.8) Aggregations (6.4.3
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 Technology. Topic 2: Relational Databases and SQL. Olaf Hartig.
Topic 2: Relational Databases and SQL Olaf Hartig olaf.hartig@liu.se Relational Data Model Recall: DB Design Process 3 Relational Model Concepts Relational database: represent data as a collection of relations
More informationData Modelling and Databases. Exercise Session 7: Integrity Constraints
Data Modelling and Databases Exercise Session 7: Integrity Constraints 1 Database Design Textual Description Complete Design ER Diagram Relational Schema Conceptual Modeling Logical Modeling Physical Modeling
More informationSQL - Subqueries and. Schema. Chapter 3.4 V4.0. Napier University
SQL - Subqueries and Chapter 3.4 V4.0 Copyright @ Napier University Schema Subqueries Subquery one SELECT statement inside another Used in the WHERE clause Subqueries can return many rows. Subqueries can
More informationDownloaded from
Lesson 16: Table and Integrity Constraints Integrity Constraints are the rules that a database must follow at all times. Various Integrity constraints are as follows:- 1. Not Null: It ensures that we cannot
More informationNESTED QUERIES AND AGGREGATION CHAPTER 5 (6/E) CHAPTER 8 (5/E)
1 NESTED QUERIES AND AGGREGATION CHAPTER 5 (6/E) CHAPTER 8 (5/E) 2 LECTURE OUTLINE More Complex SQL Retrieval Queries Self-Joins Renaming Attributes and Results Grouping, Aggregation, and Group Filtering
More informationDatabase Programming with PL/SQL
Database Programming with PL/SQL 12-1 Objectives This lesson covers the following objectives: Recall the stages through which all SQL statements pass Describe the reasons for using dynamic SQL to create
More informationDatabase Technology. Topic 3: SQL. Olaf Hartig.
Olaf Hartig olaf.hartig@liu.se Structured Query Language Declarative language (what data to get, not how) Considered one of the major reasons for the commercial success of relational databases Statements
More informationPlease pick up your name card
L06: SQL 233 Announcements! Please pick up your name card - always come with your name card - If nobody answers my question, I will likely pick on those without a namecard or in the last row Polls on speed:
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 informationChapter-14 SQL COMMANDS
Chapter-14 SQL COMMANDS What is SQL? Structured Query Language and it helps to make practice on SQL commands which provides immediate results. SQL is Structured Query Language, which is a computer language
More 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 informationMidterm Exam #1 (Version B) CS 122A Spring 2018
https://orangecounty.craigslist.org/d/housing/search/hhhname: SEAT NO.: STUDENT ID: Midterm Exam #1 (Version B) CS 122A Spring 2018 Max. Points: 100 (Please read the instructions carefully) Instructions:
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 informationCS 338 Nested SQL Queries
CS 338 Nested SQL Queries Bojana Bislimovska Spring 2017 Exercises 2. A database for an organization that shelters animals, and people can go and adopt animals that they shelter, has the following set
More informationINFOTECH Computer Education, Kishangarh (Raj) Visit : Page 1
Q 1. (a) Which protocol is used for the transfer of hypertext document on the Internet. (1) (b) Which transmission medium should be used to transfer data across two continents at very high speed? (1) (c)
More informationCSE 344 Midterm. Wednesday, February 19, 2014, 14:30-15:20. Question Points Score Total: 100
CSE 344 Midterm Wednesday, February 19, 2014, 14:30-15:20 Name: Question Points Score 1 30 2 50 3 12 4 8 Total: 100 This exam is open book and open notes but NO laptops or other portable devices. You have
More informationConstraint satisfaction problems (problémy s obmedzujúcimi podmienkami)
I2AI: Lecture 04 Constraint satisfaction problems (problémy s obmedzujúcimi podmienkami) Lubica Benuskova Reading: AIMA 3 rd ed. chap. 6 ending with 6.3.2 1 Constraint satisfaction problems (CSP) We w
More informationIT360: Applied Database Systems. SQL: Structured Query Language DDL and DML (w/o SELECT) (Chapter 7 in Kroenke) SQL: Data Definition Language
IT360: Applied Database Systems SQL: Structured Query Language DDL and DML (w/o SELECT) (Chapter 7 in Kroenke) 1 Goals SQL: Data Definition Language CREATE ALTER DROP SQL: Data Manipulation Language INSERT
More informationIndex. Bitmap Heap Scan, 156 Bitmap Index Scan, 156. Rahul Batra 2018 R. Batra, SQL Primer,
A Access control, 165 granting privileges to users general syntax, GRANT, 170 multiple privileges, 171 PostgreSQL, 166 169 relational databases, 165 REVOKE command, 172 173 SQLite, 166 Aggregate functions
More information/* --6). Name: Christopher Singleton Date: 02/12/2017 Class: PROG 140 Project: Module 04
/* --6. Name: Christopher Singleton Date: 02/12/2017 Class: PROG 140 Project: Module 04 About this Original Script: Drops Database IF EXISTS / Creates Database / Inserts three rows into three tables with
More informationMidterm Exam #2 (Version B) CS 122A Spring 2018
NAME: SEAT NO.: STUDENT ID: Midterm Exam #2 (Version B) CS 122A Spring 2018 Max. Points: 100 (Please read the instructions carefully) Instructions: - The total time for the exam is 50 minutes; be sure
More informationDatabase design process
Database technology Lecture 2: Relational databases and SQL Jose M. Peña jose.m.pena@liu.se Database design process 1 Relational model concepts... Attributes... EMPLOYEE FNAME M LNAME SSN BDATE ADDRESS
More informationHomework Assignment 2. Due Date: October 21th, :30pm (noon) CS425 - Database Organization Results
Name CWID Homework Assignment 2 Due Date: October 21th, 2014 12:30pm (noon) CS425 - Database Organization Results Please leave this empty! 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.15 2.16 2.17
More information3ISY402 DATABASE SYSTEMS
3ISY402 DATABASE SYSTEMS - SQL: Data Definition 1 Leena Gulabivala Material from essential text: T CONNOLLY & C BEGG. Database Systems A Practical Approach to Design, Implementation and Management, 4th
More informationData Base Lab. The Microsoft SQL Server Management Studio Part-3- By :Eng.Alaa I.Haniy.
Data Base Lab Islamic University Gaza Engineering Faculty Computer Department Lab -5- The Microsoft SQL Server Management Studio Part-3- By :Eng.Alaa I.Haniy. SQL Constraints Constraints are used to limit
More informationThe Relational Model
The Relational Model UVic C SC 370, Fall 2002 Daniel M. German Department of Computer Science University of Victoria September 25, 2002 Version: 1.03 3 1 The Relational Model (1.03) CSC 370 dmgerman@uvic.ca
More informationCOMP 430 Intro. to Database Systems
SELECT name FROM sqlite_master WHERE type='table' COMP 430 Intro. to Database Systems Single-table SQL Get clickers today! Slides use ideas from Chris Ré and Chris Jermaine. Clicker test Have you used
More informationAssignment #2. CS Spring 2015 Due on Friday, June 19, 2015, 9 AM For instructions on how to submit your assignment check the course website.
Assignment #2 CS 348 - Spring 2015 Due on Friday, June 19, 2015, 9 AM For instructions on how to submit your assignment check the course website. 1 CS 348 - Spring 2015 : Assignment #2 QUESTION 1. Question
More informationMTAT Introduction to Databases
MTAT.03.105 Introduction to Databases Lecture #3 Data Types, Default values, Constraints Ljubov Jaanuska (ljubov.jaanuska@ut.ee) Lecture 1. Summary SQL stands for Structured Query Language SQL is a standard
More informationGridDB Advanced Edition SQL reference
GMA022C1 GridDB Advanced Edition SQL reference Toshiba Solutions Corporation 2016 All Rights Reserved. Introduction This manual describes how to write a SQL command in the GridDB Advanced Edition. Please
More information