Digital recordkeeping and preservation I

Slides:



Advertisements
Similar presentations
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
Advertisements

Murach’s Java SE 6, C21© 2007, Mike Murach & Associates, Inc.Slide 1.
1 Query-by-Example (QBE). 2 v A “GUI” for expressing queries. –Based on the Domain Relational Calulus (DRC)! –Actually invented before GUIs. –Very convenient.
Accounting System Design
Relational Databases Chapter 4.
Database table design Single table vs. multiple tables Sen Zhang.
Introduction to Structured Query Language (SQL)
SQL components In Oracle. SQL in Oracle SQL is made up of 4 components: –DDL Data Definition Language CREATE, ALTER, DROP, TRUNCATE. Creates / Alters.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Chapter 5 Data Manipulation and Transaction Control Oracle 10g: SQL
A Guide to SQL, Eighth Edition Chapter Three Creating Tables.
Chapter 5 Introduction to SQL. Structured Query Language = the “programming language” for relational databases SQL is a nonprocedural language = the user.
Learningcomputer.com SQL Server 2008 – Introduction to Transact SQL.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
ZEIT2301 Design of Information Systems SQL: Creating a Database School of Engineering and Information Technology Dr Kathryn Merrick.
Deanery of Business & Computer Sciences SQL Structured Query Language Implementation Lecture – 8 Database Technology Level I.
1 Structured Query Language (SQL). 2 Contents SQL – I SQL – II SQL – III SQL – IV.
MySQL Database Connection
Chapter 8 Databases.
1 DBS201: Introduction to Structure Query Language (SQL) Lecture 1.
Database revision.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 7 (Part II) INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) Instructor.
Database Security Lesson Introduction ●Understand the importance of securing data stored in databases ●Learn how the structured nature of data in databases.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Chapter 3: Relational Databases
Manipulating Data Lesson 3. Objectives Queries The SELECT query to retrieve or extract data from one table, how to retrieve or extract data by using.
Oracle 10g Database Administrator: Implementation and Administration Chapter 10 Basic Data Management.
11-1 © Prentice Hall, 2004 Chapter 11: Physical Database Design Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich,
7 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel 7.6 Advanced Select Queries SQL provides useful functions that.
Understand Data Definition Language (DDL) Database Administration Fundamentals LESSON 1.4.
 MySQL  DDL ◦ Create ◦ Alter  DML ◦ Insert ◦ Select ◦ Update ◦ Delete  DDL(again) ◦ Drop ◦ Truncate.
Oracle 11g: SQL Chapter 5 Data Manipulation and Transaction Control.
Digital recordkeeping and preservation I
Fundamental of Database Systems
Database commands : DDL
3 A Guide to MySQL.
Databases and DBMSs Todd S. Bacastow January
Fundamentals of DBMS Notes-1.
Digital recordkeeping and preservation I
Chapter 5 Introduction to SQL.
Chapter 6: Integrity (and Security)
CS320 Web and Internet Programming SQL and MySQL
Database to XML extractions
Active Database Concepts
SQL in Oracle.
Understand Data Manipulation Language (DML)
Introduction to Oracle9i: SQL
CS1222 Using Relational Databases and SQL
Microsoft Access 2003 Illustrated Complete
Understand Data Manipulation Language (DML)
SQL 101.
Structured Query Language (Data definition Language)
Accounting System Design
Database Fundamentals
The Relational Model Relational Data Model
Teaching slides Chapter 8.
Insert, Update, Delete Manipulating Data.
مقدمة في قواعد البيانات
Unit I-2.
Accounting System Design
Session - 6 Sequence - 1 SQL: The Structured Query Language:
CS3220 Web and Internet Programming SQL and MySQL
Session - 6 Sequence - 5 SQL Updating Database Contents
MIS2502: Data Analytics SQL 4– Putting Information Into a Database
CS3220 Web and Internet Programming SQL and MySQL
Integrity 5/5/2019 See scm-intranet.
DATABASE Purpose of database
Manipulating Data Lesson 3.
Presentation transcript:

Digital recordkeeping and preservation I Databases : DML ARK2100 Digital recordkeeping and preservation I 2017 Thomas Sødring thomas.sodring@hioa.no P48-R407 67238287

Data Manipulation Language (DML) DML is a database language designed for manipulating data in relational databases DML is used to insert, update or delete data in a table INSERT UPDATE DELETE

DML INSERT Data is inserted into a relation one row at a time The minimum you need is the primary key Unless there are restrictions on other attributes e.g. NOT NULL Even if you are inserting many rows (batch import), data is inserted one tuple at a time Data that is across two rows in different tables can be inserted together There is no requirement for transaction Remember referential integrity

INSERT INTO TABLE (attributtelist) VALUES (valuelist);

INSERT INTO TABLE VALUES ();

INSERT Car # Example 1 INSERT INTO Car (registrationNr, chassisNr, colour, manufacturer, model) VALUES ("ZQ10000", "111592315", "black", "Audi", "A3"); # Example 2 INSERT INTO Car VALUES

INSERT Car

INSERT Car ??

INSERT Car

After INSERT Car

INSERT Car (multiple rows) INSERT INTO Car (registrationNr, chassisNr, colour, manufacturer, model) VALUES ("ZQ10001", "516592316", "red", "Audi", "A5"), ("ZQ10002", "136695919", "blue", "VW", "Golf");

INSERT Car (multiple rows)

After INSERT Car (multiple rows)

Take a look at Car

SQL UPDATE A tuple can be updated/changed with the UPDATE command You can change the values of fields Many tuples can be updated simultaneously with one command Updated one at a time Remember, there is usually no [CTRL] + [Z] (undo) button You can do a lot of harm to a database if you are not careful

UPDATE SET WHERE;

UPDATE TABLE SET Attribute='value' WHERE;

UPDATE Car SET registrationNr = "ZQ10099" WHERE

UPDATE Car

After UPDATE Car

UPDATE Car SET colour = "pink" WHERE registrationNr = "ZQ10099" ;

UPDATE Bil

After UPDATE Car

Take a look at Car

UPDATE Car UPDATE Car SET colour = "red"; What will happen here?

Update Car

Take a look at Car

DELETE FROM WHERE;

DELETE FROM TABLE WHERE;

DELETE Car DELETE FROM Car WHERE registrationNr = "ZQ10099" ;

DELETE Car

After DELETE Car

Take a look at Car

DELETE Car DELETE FROM Car; What will happen here?

Fill up the Car relation The following link will allow you to insert a lot of data into the Car relation https://bibin.hioa.no/~tsodring/php/make_cars.html The username is your studentId Use the password you created for mysql/phpmyadmin The database must exist and contain a table called Car

Car with many records

TRUNCATE Car; Truncate We can easily empty the table using the truncate command You need to run the script again to fill up the table TRUNCATE Car;

Summary Manipulation of data is done using insert, update or delete It's very easy to create problems with your data Always use the WHERE clause when you create an UPDATE or DELETE command Care must be taken especially with these as there is usually no undo button The application on top of the database might break if you aren't careful