Introduction CSC 330 Object Oriented Programming C# and Databases Introduction to Database Management System What are Databases?

Size: px
Start display at page:

Download "Introduction CSC 330 Object Oriented Programming C# and Databases Introduction to Database Management System What are Databases?"

Transcription

1 CSC 330 Object Oriented ming C# and Databases Database: Introduction Integrated collection of data Database management system (DBMS) Provides mechanisms for storing and organizing data in a way that is consistent with database s format Allows storage and access to database without knowledge of internal representation Relational Databases most popular Use Structured Query Language to perform queries (search) and manipulate data ming languages need an interface to interact with relational databases 2 Introduction to Database Management System What are Databases? A database management system (DBMS) is software that manages large collections of data It is designed to store, retrieve, and manipulate data A C# application can interact with a DBMS through a 3-layer manipulation Application: interacts with the user and sends instructions to DBMS DBMS: works directly with the data and sends the result back to the application Data: the data stored in DBMS Application DBMS Features of DBMS Definition of data structure Maintenance facility Allow access to and storage of data independently of the internal representation of data Main job of the DBMS is to ensure data integrity Data 3 4 Relational Database Systems and SQL Relational database systems are the most popular today (Microsoft Access is a relational database system) SQL is international standard language used with relational database systems to perform queries (i.e. to request information that satisfies given criteria) and to manipulate data Some popular relational database management systems (RDBMS) are Microsoft SQL Server, Oracle, MySQL, Sybase Relational Database Model Logical representation of data: Relationships can be considered without concern for physical structure of data Composed of tables Rows called records Columns called fields Primary key: field that contains unique data Each record can be identified by at least one distinct value New sets made from queries called result sets 5 6 1

2 Tables, Rows, and Columns Data stored in a database are organized into tables, rows, and columns Each table holds a collection of related data A table is a two-dimensional container made of rows and columns A row is a complete set of information about a single item A column holds an individual piece of information about the item Column Data Types When you create a database table, you must specify a data type for the column Acceptable data types are defined by DBMS, not C# SQL Server Description Corresponding C# or.net Framework Data Type Data Type bit True/false values bool datetime A date and a time DateTime decimal(t, d) A decimal value with t total digits and d digits appearing after the decimal point. decimal Name Phone float Real numbers double int An integer number int Each row contains data about one person Katie Allen Jill Ammons Kevin Brown Elisa Garcia Jeff Jenkins money Values that represent currency decimal nchar(n) A fixed-length Unicode string with a maximum length of n characters. string nvarchar(n) A variable-length Unicode string with a maximum length of n characters. string 7 8 Relational Database Model All information is contained in tables (or relations) Tuple or row (record) Attribute or column (field) Relationships [not why called relational] Relation Instance The current values (relation instance) of a relation are specified by a table An element t of r is a tuple, represented by a row in a table customer_name customer_street customer_city attributes (or columns) Jones Smith Curry Lindsay Main North North Park Harrison Rye Rye Pittsfield tuples (or rows) customer 9 10 Relational Database Model Relationships are logical representation of data: Not concerned with physical structure Primary key: field that contains unique data Each record can be identified by at least one distinct value record/row number name department salary location Jones New Jersey Kerwin New Jersey Larson Los Angeles Myers Orlando Neumann New Jersey Stephens Orlando Primary Keys Most database tables have a primary key A primary key is a column that can be used to identify a specific row The column that is designated as the primary key must hold a unique value for each row. For example, Employee ID, social security number, invoice number, sales order number Sometimes the data that you want to store in a table does not contain any unique items that can be used as a primary key You need to create an identity column specifically to serve as the primary key. This column is known as an identify column. Identify columns typically contain integers Each time a new row is added to the table, the DBMS automatically assigns a unique value to the identify column primary key field/column

3 Primary Keys Relational DBMS enforces several constraints on data Rule of Entity Integrity: in most cases every record has a unique value in its primary- key field Primary key does not have to be a single field Compound Primary Key: when a record has a unique key based on a combination of two fields Foreign Keys A foreign key is used to create relationships: Field for which every entry has a unique value in another table and where the field in the other table is the primary key for that table Rule of Referential Integrity: every foreign- key field value must appear in another table s primary- key field One to many relationship: A foreign key can appear many times in its own table, but only once as primary key in another table Rule of Entity Integrity: in most cases every record every record hasa unique value in its primary-key field Compound Primary key: when a record has a unique key based on a combination of two fields Foreign key: Field for which every entry has a unique value in another table and where the field in the other table is the primary key for that table Rule of Referential Integrity: every foreign-key field value must appear in another table s primary-key field One to many relationship: A foreign key can appear many times in its own table, but only once as primary key in another table Fie ld authorid firstname Desc rip tion Author s ID number in the database. In the Books database, this int field is defined as an auto-incremented field. For each new record inserted in this table, the database increments the authorid value, ensuring that each record has a unique authorid. This field represents the table s primary key. Author s first name (a string). lastname Author s last name (a string). Fig Authors table from Books Fig Data from the Authors table of Books. 17 Field publisherid publishername Fig Description The publisher s ID number in the database. This auto-incremented int field is the table s primary-key field. The name of the publisher (a string). Publishers table from Books. publisherid publishername 1 Prentice Hall 2 Prentice Hall PTG Fig Field authorid Data from the Publishers table of Books. Desc rip tion The author s ID number, which allows the database to associate each book with a specific author. The integer ID number in this field must also appear in the Authors table. isbn The ISBN number for a book (a string). Fig AuthorISBN table from Books. 18 3

4 authorid isbn authorid isbn x x x Fig Data from AuthorISBN ta b le in Books. 19 Fie ld isbn title editionnumber copyright publisherid imagefile price Fig Desc rip tion ISBN number of the book (a string). Title of the book (a string). Edition number of the book (a string). Copyright year of the book (an int). Publisher s ID number (an int). This value must correspond to an ID number in the Publishers table. Name of the file containing the book s cover image (a string). Suggested retail price of the book (a real number). [Note: The prices shown in this database are for example purposes only.] Titles table from Books. 20 Fig part 1 isbn title edition- publish- copyright imagefile price Number erid P y th o n H o w to 1 1 python.jpg $69.95 C# H ow to cshtp.jpg $69.95 J a v a H o w to jhtp4.jpg $69.95 The Complete Java javactc4.jpg $ A dvanced Java advjhtp1.jpg $69.95 Platform H ow to Intern et and W orld iw3htp2.jpg $69.95 W ide W eb How to V isual B asic.n ET vbnet.jpg $69.95 H o w to P r o g r a m T h e C o m p le t e C cppctc3.jpg $ T he C om p lete e ebecctc.jpg $ B usiness & e- C o m m e r c e m ing X The C om plete iw3ctc2.jpg $ Intern et & W orld W ide W eb m ing The Complete Perl perl.jpg $ The Complete xmlctc.jpg $ XM L m ing 21 Fig part C H ow to chtp3.jpg $ C++ How to cpphtp3.jpg $69.95 e-business X and e ebechtp1.jpg $69.95 C om m erce H ow to W ireless Internet wireless.jpg $69.95 an d M ob ile B usiness H ow to Perl H ow to perlhtp1.jpg $69.95 XM L How to xmlhtp1.jpg $69.95 The C om plete iw3ctc1.jpg $ Intern et and W orld W id e W eb ming Training C ourse Java H ow to jhtp3.jpg $69.95 Pro gram (Java 2 ) The Complete Java javactc3.jpg $ Training C ourse e-business and e ebecm.jpg $69.95 C om m erce for M a n a g ers Intern et and W orld iw3htp1.jpg $69.95 W id e W eb H o w to G etting S tarted gsvc.jpg $49.95 with Visual C++ 6 with an Intro du ctio n to M F C 22 Fig part The Complete vbctc1.jpg $ Visual Basic 6 Visual Basic vbhtp1.jpg $69.95 How to Java M ultim edia javactc.jpg $ Cyber Classroom The Entity- relationship diagram for the Book database Java How to jhtp1.jpg $ The Complete C cppctc2.jpg $ C++ How to cpphtp2.jpg $49.95 The Complete Java javactc2.jpg $ The Complete Java javactc2.jpg $99.95 (Java 1.1) Java How to jhtp2.jpg $49.95 (Java 1.1) C++ How to cpphtp1.jpg $ C How to chtp2.jpg $ C How to chtp.jpg $69.95 Authors authorid firstname lastname 1 AuthorISBN authorid isbn 1 Publishers publisherid publishername Titles isbn title editionnumber copyright 1 publisherid imagefile price Fig Da ta fro m the Titles table of Books

5 Relational Database Queries Queries : return a new result set Based upon relational algebra Uses 3 operations to build a new relation (a result-set) Projection, selection, and join What is SQL? Structured Query Language (SQL) Keywords and rules used to implement relational algebra operations SQL Keywords Basic Select Query SQL ke yw o rd SELECT FROM WHERE INNER JOIN GROUP BY ORDER BY INSERT UPDATE DELETE Fig SQL query keywords. Description Selects (retrieves) fields from one or more tables. Specifies tables from which to get fields or delete records. Required in every SELECT and DELETE statement. Specifies criteria that determine the rows to be retrieved. Joins records from multiple tables to produce a single set of records. Specifies criteria for grouping records. Specifies criteria for ordering records. Inserts data into a specified table. Updates data in a specified table. Deletes data from a specified table. Extracts information from one or more tables in a database Format: Basic: select * from table-name select * from authors * means "extract all columns" To get a projection (specific columns), use a list: select firstname, lastname from authors Column, table names may be case sensitive SQL keywords should not be case sensitive Basic Select Query Where Clause authorid lastname authorid lastname 1 Deitel 8 McPhie 2 Deitel 9 Yaeger 3 Nieto 10 Zlatkina 4 Steinbuhler 12 Wiedermann 5 Santry 12 Liperi 6 Lin 13 Listfield 7 Sadhu Fig authorid and lastname from the Authors table. 29 Used to specify certain criteria in a query Basic form: SELECT * FROM tablename WHERE criteria SELECT * FROM Titles WHERE copyright > 1999 Can use LIKE clause Used for pattern matching Uses wildcards *: zero or more characters take its place?: exactly one character takes its place 30 5

6 Pattern-matching with Where Can use like clause for string pattern matching Uses wildcards %: zero or more characters take its place (*) _: exactly one character takes its place (?) Examples: Select * from authors where firstname like '_e%' Select * from authors where lastname like 'D%' 31 WHERE Clause Title editionnumber copyright Internet and W orld W ide W eb H ow to P rogram Java How to The Complete Java The Complete e-business & e-commerce ming T h e C o m p le te In te rn e t & W o rld W id e W eb m ing The Complete Perl The Complete XM L m ing C How to C++ How to The Complete C e-business and e-com m erce How to Internet and W orld W ide W eb H ow to P rogram The Com plete Internet and W orld W ide W eb m ing Java How to (Java 2) The Complete Java XM L How to P erl H ow to P rogram Advanced Java 2 Platform How to e-business and e-com m erce for M anagers W ireless Internet and M obile Business How to C# How To Python How to V isu al B asic.n E T H o w to P ro g ram Fig Title s w ith c o p yrig h ts a fte r 1999 fro m ta b le Titles. 32 WHERE Clause Sorting the Results Fig Authors from the Authors ta b le w ho se last na m es sta rt w ith D. Fig Authors from table Authors whose last names contain i as the second letter. SQL queries return their data in indeterminate order Same query may return rows in different order each time Use the order by clause to arrange results of a query Can be ascending (asc) or descending (desc) order Examples: select * from authors order by lastname desc select * from authors order by lastname, firstname asc ORDER BY Clause Used to arrange results of a query Can be ascending or descending order Uses ASC and DESC respectively SELECT authorid FROM Authors ORDER BY authorid ASC Can be used to sort by multiple fields 35 ORDER BY Clause Fig Authors from table Authors in ascending order by lastname. 36 6

7 ORDER BY Clause Fig Authors from table Authors in descending order by lastname. 37 ORDER BY Clause Fig Authors from table Authors in ascending order by lastname and by firstname. 38 ORDER BY Clause isbn title edition- copyright price Number Advanced Java 2 Platform 1 $69.95 How to Merging Data from Multiple Tables: INNER JOIN Merges records from multiple tables into a single record Tests for matching values in a common field C How to $ C How to $ C How to $ C# How To $ C++ How to $49.95 General Form: C++ How to $ C++ How to $69.95 select * from table X e-b usiness and e-com m erce $69.95 How to Internet and W orld W ide W eb $69.95 inner join table 2 on table1.field = table2.field How to Internet and W orld W ide W eb $69.95 How to Java How to $ Java How to $49.95 select firstname, isbn from Perl How to $ Python H ow to $69.95 authors inner join authorisbn Visual Basic.NET How to $69.95 Visual Basic How to $69.95 on authors.authorid = authorsisbn.authorid W ireless In te rnet and M ob ile $69.95 B usiness H ow to XML How to $69.95 Books from table Titles w hose titles end w ith How to in Fig a sc e n d in g o rd e r b y title. 40 Merging Data from Multiple Tables: INNER JOIN firstname lastname isbn firstname lastname isbn Harvey D eitel Harvey D eitel Harvey D eitel Harvey Deitel Harvey D eitel Paul Deitel Harvey D eitel Paul Deitel Harvey D eitel Paul Deitel Harvey D eitel Paul Deitel x Harvey D eitel x Paul Deitel Harvey D eitel Paul Deitel Harvey D eitel Paul Deitel Harvey D eitel Paul Deitel Harvey D eitel Paul Deitel Harvey D eitel Paul Deitel Harvey D eitel Tem Nieto Paul D eitel Tem Nieto Paul D eitel Paul D eitel Paul D eitel Tem Nieto Paul D eitel Tem Nieto Paul D eitel x Paul D eitel Fig A utho rs fro m ta b le Authors and ISBN num bers of the authors books, sorted in ascending order by lastname and firstname. 41 Joining Data from Tables Authors, AuthorISBN,, Titles and Publishers Tables produced by INNER JOIN can be used as arguments for another INNER JOIN 42 7

8 Joining Data from Tables Authors, AuthorISBN, Titles and Publishers 1 SELECT Titles.title, Titles.isbn, Authors.firstName, 2 Authors.lastName, Titles.copyright, 3 Publishers.publisherName 4 FROM 5 ( Publishers INNER JOIN Titles 6 ON Publishers.publisherID = Titles.publisherID ) 7 INNER JOIN 8 ( Authors INNER JOIN AuthorISBN 9 ON Authors.authorID = AuthorISBN.authorID ) 10 ON Titles.isbn = AuthorISBN.isbn 11 ORDER BY Titles.title Join two created tables if titlesisbn matches authorsisbn Fig TitleAuthor query of Books database. Join Publishers and Titles tables if the publisherid matches Join Authors and AuthorISBN if authorid matches Sort new table by title Fig part 1 Joining Data from Tables Authors, AuthorISBN, Titles and Publishers Title isbn first- last- copyright publisher- Name Name Name Advanced Java 2 Platform Paul Deitel 2002 Prentice H all How to Advanced Java 2 Platform Prentice H all How to Advanced Java 2 Platform Sean Santry 2002 Prentice H all How to C How to Harvey Deitel 1992 Prentice H all C How to Paul Deitel 1992 Prentice H all C How to Harvey Deitel 1994 Prentice H all C How to Paul Deitel 1994 Prentice H all C How to Harvey Deitel 2001 Prentice H all C How to Paul Deitel 2001 Prentice H all C# How To Tem Nieto 2002 Prentice H all C# How To Paul Deitel 2002 Prentice H all C# How To Jeffrey Listfield 2002 Prentice H all C# How To Cheryl Yaeger 2002 Prentice H all C# How To Marina Zlatkina 2002 Prentice H all C# How To Harvey Deitel 2002 Prentice H all C++ How to Paul Deitel 2001 Prentice H all Fig part 2 Joining Data from Tables Authors, AuthorISBN, Titles and Publishers C++ How to Harvey Deitel 2001 Prentice Hall C++ How to Paul Deitel 1994 Prentice Hall C++ How to Harvey Deitel 1994 Prentice Hall C++ How to Harvey Deitel 1998 Prentice Hall C++ How to Paul Deitel 1998 Prentice Hall for Managers for Managers for Managers How to How to How to Harvey Deitel 2000 Prentice Hall Kate Steinbuhl er 2000 Prentice Hall Paul Deitel 2000 Prentice Hall X Harvey Deitel 2001 Prentice Hall X Paul Deitel 2001 Prentice Hall X Tem Nieto 2001 Prentice Hall Fig Portion of the result set produced by the query in Fig The Selection Operation The selection operation is accomplished using where Basic form: select * from table-name where criteria select * from titles where copyright > 1999 Make sure String criteria are inside single quotes Can use expected relational operators select * from authors where firstname > 'B' SQL and Relational Operators with the Where Clause SQL String Functions SQL supports several relational operators for writing conditional expressions Operator Meaning > Greater than < Less than >= Greater than or equal to <= Less than or equal to = Equal to <> Not equal to SQL keywords and clauses are not case-sensitive. But, string comparison are. Denim Jeans, denim jeans, and Denim jeans are considered three different string literals The following three SQL statements will generate three different results: SELECT * FROM Product WHERE Description = Denim Jeans SELECT * FROM Product WHERE Description = denim jeans SELECT * FROM Product WHERE Description = Denim jeans You can use the Lower() or Upper() string function before performing the comparison SELECT * FROM Product WHERE Lower(Description) = denim jeans SELECT * FROM Product WHERE Upper(Description) = DENIM JEANS

9 Using the LIKE Operator Sorting the Results of a Select Query The LIKE operator allows you to do a search based on a pattern rather than specifying exactly what is desired Oxford Cloth Shirt and Poplin Shirt both contains the string Shirt Use the string Shirt as the pattern with the wildcard character % % represents any sequence of zero or more characters SELECT * FROM Product WHERE Description LIKE %Shirt% SELECT * FROM Product WHERE Description LIKE Chino% SELECT * FROM Product WHERE Description LIKE %jeans The underscore (_) wildcard character represents a single character. To search for all rows in which Product_Number begins with 2, followed by any one character, followed by -0, followed by any one character, use SELECT * FROM Product WHERE Product_Number LIKE 2_-0_ To sort the results of a SELECT query, use the ORDER BY clause SELECT * FROM Product ORDER BY Price SELECT * FROM Product WHERE Price > ORDER BY Price The results will be sorted in ascending order To sort in descending order, use the Desc operator SELECT * FROM Product ORDER BY Price Desc SELECT * FROM Product WHERE Price > ORDER BY Price Desc Insert Statement Inserts a new record into a table General form: insert into table-name(fieldname1, fieldname2,...) values(value1, value2) insert into authors(authorid, lastname, firstname) values(15, 'Gilbert', 'Steve') Values must match field names in order and type 51 INSERT Statement 14 Sue Smith Fig Authors after an INSERT operation to add a record. 52 The Update Statement Modifies data in a table General Form: update table-name set field1=value1 where criteria update authors set firstname='stephen' where lastname='gilbert' and firstname='steve' What happens if you violate an integrity rule? 53 UPDATE Statement 14 Sue Jones Fig Table Authors after an UPDATE operation to change a record. 54 9

10 The Delete Statement Removes data from a table General Form: delete from table-name where criteria Don't forget the criteria!!! delete from authors where lastname='gilbert' DELETE Statement Fig Table Authors after a DELETE operation to remove a record SQL Math Functions Creating a Database in Visual Studio SQL provides several functions for performing calculations Avg(Column): calculates the average value in a particular column SELECT Avg(Price) FROM Product Sum(Column): calculates the sum of a column s values SELECT Sum(Price) FROM Product Min(Column): finds the minimum value of a column. SELECT Min(Price) FROM Product Max(Column): finds the maximum value of a column SELECT Max(Price) FROM Product Count(Column): returns the number of values of the specified column SELECT Count(Price) FROM Product To determine the number of rows in a table, use: SELECT Count(*) FROM Product A.NET application uses several components, arranged in layers, to connect to a database Data Source a source of data with which the application can work Table Adapter connects to a data source and retrieves data from a table in a data source Dataset gets a copy of a table from the table adapter and keeps the copy of the table in memory Binding Source a component that can connect user interface controls directly to a dataset Application Binding Source Dataset Table Adapter Data Source Creating A Server-Based Database The Database File s Location Visual Studio provides wizards that make it easy to create and configure the database The Add New Item window provides a Service-based Database option for creating an empty SQL Server database The default name of the SQL Server database is Database1.mdf This book uses SQL Server database as examples When you use Visual Studio to create a SQL server database, the database file will be created in the project s folder The project s folder is where the Form1.cs, Form1.Designer.cs, and.cs files are stored The file extension is.mdf. For example, Phonelist.mdf. The server will also create a file that ends with the.ldf extension. For example, Phonelist_log.LDF. This is a transaction log file used to keep a log of all the operations that you perform on the database

Database: Integrated collection of data

Database: Integrated collection of data CSC 330 Object Oriented Programming C# and Databases Introduction Database: Integrated collection of data Database management system (DBMS) Provides mechanisms for storing and organizing data in a way

More information

840 Database: SQL, ADO and RDS Chapter 25. Department Salary Location

840 Database: SQL, ADO and RDS Chapter 25. Department Salary Location iw3htp_25.fm Page 840 Tuesday, May 23, 2000 6:11 AM 840 Database: SQL, ADO and RDS Chapter 25 A record Number Name 25 Database: SQL, ADO and RDS Table: Employee Department Salary Location 23603 JONES,

More information

30. Structured Query Language (SQL)

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

More information

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

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

More information

CSC Web Programming. Introduction to SQL

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

More information

RESTRICTING AND SORTING DATA

RESTRICTING AND SORTING DATA RESTRICTING AND SORTING DATA http://www.tutorialspoint.com/sql_certificate/restricting_and_sorting_data.htm Copyright tutorialspoint.com The essential capabilities of SELECT statement are Selection, Projection

More information

Jarek Szlichta

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

More information

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

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

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 11: Connection to Databases Lecture Contents 2 What is a database? Relational databases Cases study: A Books Database Querying

More information

SQL CHEAT SHEET. created by Tomi Mester

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

More information

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

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

More information

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

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

More information

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

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

More information

Ten Great Reasons to Learn SAS Software's SQL Procedure

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

More information

SQL for MySQL A Beginner s Tutorial

SQL for MySQL A Beginner s Tutorial SQL for MySQL A Beginner s Tutorial Djoni Darmawikarta SQL for MySQL: A Beginner s Tutorial Copyright 2014 Brainy Software Inc. First Edition: June 2014 All rights reserved. No part of this book may be

More information

SQL stands for Structured Query Language. SQL is the lingua franca

SQL stands for Structured Query Language. SQL is the lingua franca Chapter 3: Database for $100, Please In This Chapter Understanding some basic database concepts Taking a quick look at SQL Creating tables Selecting data Joining data Updating and deleting data SQL stands

More information

Database Management Systems,

Database Management Systems, Database Management Systems SQL Query Language (2) 1 Topics Update Query Delete Query Integrity Constraint Cascade Deletes Deleting a Table Join in Queries Table variables More Options in Select Queries

More information

Logical Operators and aggregation

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

More information

SQL Data Definition and Data Manipulation Languages (DDL and DML)

SQL 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 information

Chapter 16: Databases

Chapter 16: Databases Chapter 16: Databases Starting Out with Java: From Control Structures through Objects Fifth Edition by Tony Gaddis Chapter Topics Chapter 16 discusses the following main topics: Introduction to Database

More information

CST272 SQL Server, SQL and the SqlDataSource Page 1

CST272 SQL Server, SQL and the SqlDataSource Page 1 CST272 SQL Server, SQL and the SqlDataSource Page 1 1 2 3 4 5 6 7 8 9 SQL Server, SQL and the SqlDataSource CST272 ASP.NET Microsoft SQL Server A relational database server developed by Microsoft Stores

More information

Full file at

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

More information

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

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

More information

CIS 209 Final Exam. 1. A Public Property procedure creates a property that is visible to any application that contains an instance of the class.

CIS 209 Final Exam. 1. A Public Property procedure creates a property that is visible to any application that contains an instance of the class. CIS 209 Final Exam Question 1 1. A Property procedure begins with the keywords. Public [ReadOnly WriteOnly] Property Private [ReadOnly WriteOnly] Property Start [ReadOnly WriteOnly] Property Dim [ReadOnly

More information

EE221 Databases Practicals Manual

EE221 Databases Practicals Manual EE221 Databases Practicals Manual Lab 1 An Introduction to SQL Lab 2 Database Creation and Querying using SQL Assignment Data Analysis, Database Design, Implementation and Relation Normalisation School

More information

CSE 132A Database Systems Principles

CSE 132A Database Systems Principles CSE 132A Database Systems Principles Prof. Alin Deutsch RELATIONAL DATA MODEL Some slides are based or modified from originals by Elmasri and Navathe, Fundamentals of Database Systems, 4th Edition 2004

More information

Chapter 2: Relational Model

Chapter 2: Relational Model Chapter 2: Relational Model Database System Concepts, 5 th Ed. See www.db-book.com for conditions on re-use Chapter 2: Relational Model Structure of Relational Databases Fundamental Relational-Algebra-Operations

More information

CONCEPT ON STRUCTURED QUERY LANGUAGE (SQL) By: Rohan Byanjankar Sainik Awasiya Mahavidyalaya, Sallaghari, Bhaktapur

CONCEPT ON STRUCTURED QUERY LANGUAGE (SQL) By: Rohan Byanjankar Sainik Awasiya Mahavidyalaya, Sallaghari, Bhaktapur CONCEPT ON STRUCTURED QUERY LANGUAGE (SQL) By: Rohan Byanjankar Sainik Awasiya Mahavidyalaya, Sallaghari, Bhaktapur 1 Structured Query Language Structured Query Language (SQL) is the special purposed programming

More information

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

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

More information

Chapter-14 SQL COMMANDS

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

More information

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

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

More information

WHAT IS A DATABASE? There are at least six commonly known database types: flat, hierarchical, network, relational, dimensional, and object.

WHAT IS A DATABASE? There are at least six commonly known database types: flat, hierarchical, network, relational, dimensional, and object. 1 WHAT IS A DATABASE? A database is any organized collection of data that fulfills some purpose. As weather researchers, you will often have to access and evaluate large amounts of weather data, and this

More information

QQ Group

QQ Group QQ Group: 617230453 1 Extended Relational-Algebra-Operations Generalized Projection Aggregate Functions Outer Join 2 Generalized Projection Extends the projection operation by allowing arithmetic functions

More information

Constraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2

Constraints. Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers. John Edgar 2 CMPT 354 Constraints Primary Key Foreign Key General table constraints Domain constraints Assertions Triggers John Edgar 2 firstname type balance city customerid lastname accnumber rate branchname phone

More information

COMM 391. Objectives. Introduction to Microsoft Access. What is in an Access database file? Introduction to Microsoft Access 2010

COMM 391. Objectives. Introduction to Microsoft Access. What is in an Access database file? Introduction to Microsoft Access 2010 Objectives COMM 391 Introduction to Management Information Systems Introduction to Microsoft Access 2010 Describe the major objects in Access database. Define field, record, table and database. Navigate

More information

Relational Databases. APPENDIX A Overview of Relational Database Structure and SOL

Relational Databases. APPENDIX A Overview of Relational Database Structure and SOL APPENDIX A Overview of Relational Database Structure and SOL - THIS APPENDIX CONTAINS a brief overview of relational databases and the Structured Query Language (SQL). It provides the basic knowledge necessary

More information

Data Infrastructure IRAP Training 6/27/2016

Data Infrastructure IRAP Training 6/27/2016 Data Infrastructure IRAP Training 6/27/2016 UCDW Database Models Integrity Constraints Training Database SQL Defined Types of SQL Languages SQL Basics Simple SELECT SELECT with Aliases SELECT with Conditions/Rules

More information

Intro to Structured Query Language Part I

Intro to Structured Query Language Part I Intro to Structured Query Language Part I The Select Statement In a relational database, data is stored in tables. An example table would relate Social Security Number, Name, and Address: EmployeeAddressTable

More information

HOW TO CREATE AND MAINTAIN DATABASES AND TABLES. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL

HOW TO CREATE AND MAINTAIN DATABASES AND TABLES. By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL HOW TO CREATE AND MAINTAIN DATABASES AND TABLES By S. Sabraz Nawaz Senior Lecturer in MIT FMC, SEUSL What is SQL? SQL (pronounced "ess-que-el") stands for Structured Query Language. SQL is used to communicate

More information

Language. f SQL. Larry Rockoff COURSE TECHNOLOGY. Kingdom United States. Course Technology PTR. A part ofcenqaqe Learninq

Language. f SQL. Larry Rockoff COURSE TECHNOLOGY. Kingdom United States. Course Technology PTR. A part ofcenqaqe Learninq Language f SQL Larry Rockoff Course Technology PTR A part ofcenqaqe Learninq *, COURSE TECHNOLOGY!» CENGAGE Learning- Australia Brazil Japan Korea Mexico Singapore Spain United Kingdom United States '

More information

Simple SQL. Peter Y. Wu. Dept of Computer and Information Systems Robert Morris University

Simple SQL. Peter Y. Wu. Dept of Computer and Information Systems Robert Morris University Simple SQL Peter Y. Dept of Computer and Information Systems Robert Morris University Simple SQL create table drop table insert into table values ( ) delete from table where update table set a to v where

More information

Database Management Systems,

Database Management Systems, Database Management Systems SQL Query Language (1) 1 Topics Introduction SQL History Domain Definition Elementary Domains User-defined Domains Creating Tables Constraint Definition INSERT Query SELECT

More information

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

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

More information

Structure Query Language (SQL)

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

More information

You can write a command to retrieve specified columns and all rows from a table, as illustrated

You can write a command to retrieve specified columns and all rows from a table, as illustrated CHAPTER 4 S I N G L E - TA BL E QUERIES LEARNING OBJECTIVES Objectives Retrieve data from a database using SQL commands Use simple and compound conditions in queries Use the BETWEEN, LIKE, and IN operators

More information

SQL Data Query Language

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

More information

Institute of Aga. Network Database LECTURER NIYAZ M. SALIH

Institute of Aga. Network Database LECTURER NIYAZ M. SALIH 2017 Institute of Aga Network Database LECTURER NIYAZ M. SALIH Database: A Database is a collection of related data organized in a way that data can be easily accessed, managed and updated. Any piece of

More information

Databases (MariaDB/MySQL) CS401, Fall 2015

Databases (MariaDB/MySQL) CS401, Fall 2015 Databases (MariaDB/MySQL) CS401, Fall 2015 Database Basics Relational Database Method of structuring data as tables associated to each other by shared attributes. Tables (kind of like a Java class) have

More information

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

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

More information

CGS 3066: Spring 2017 SQL Reference

CGS 3066: Spring 2017 SQL Reference CGS 3066: Spring 2017 SQL Reference Can also be used as a study guide. Only covers topics discussed in class. This is by no means a complete guide to SQL. Database accounts are being set up for all students

More information

SQL Simple Queries. Chapter 3.1 V3.01. Napier University

SQL Simple Queries. Chapter 3.1 V3.01. Napier University SQL Simple Queries Chapter 3.1 V3.01 Copyright @ Napier University Introduction SQL is the Structured Query Language It is used to interact with the DBMS (database management system) SQL can Create Schemas

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 6 Basic SQL Slide 6-2 Chapter 6 Outline SQL Data Definition and Data Types Specifying Constraints in SQL Basic Retrieval Queries in SQL INSERT, DELETE, and UPDATE Statements in SQL Additional Features

More information

Lecture 2: Chapter Objectives. Relational Data Structure. Relational Data Model. Introduction to Relational Model & Structured Query Language (SQL)

Lecture 2: Chapter Objectives. Relational Data Structure. Relational Data Model. Introduction to Relational Model & Structured Query Language (SQL) Lecture 2: Database Resources Management Fall - 1516 Chapter Objectives Basics of Relational Model SQL Basics of SELECT statement Introduction to Relational Model & Structured Query Language (SQL) MIS511-FALL-

More information

Exact Numeric Data Types

Exact Numeric Data Types SQL Server Notes for FYP SQL data type is an attribute that specifies type of data of any object. Each column, variable and expression has related data type in SQL. You would use these data types while

More information

Session 6: Relational Databases

Session 6: Relational Databases INFM 603: Information Technology and Organizational Context Session 6: Relational Databases Jimmy Lin The ischool University of Maryland Thursday, October 16, 2014 Databases Yesterday Databases Today What

More information

Lecture 2: Chapter Objectives

Lecture 2: Chapter Objectives Lecture 2: Database Resources Management Fall - 1516 Introduction to Relational Model & Structured Query Language (SQL) MIS511-FALL- 1516 1 Chapter Objectives Basics of Relational Model SQL Basics of SELECT

More information

1 INTRODUCTION TO EASIK 2 TABLE OF CONTENTS

1 INTRODUCTION TO EASIK 2 TABLE OF CONTENTS 1 INTRODUCTION TO EASIK EASIK is a Java based development tool for database schemas based on EA sketches. EASIK allows graphical modeling of EA sketches and views. Sketches and their views can be converted

More information

Structured Query Language (SQL) Part A. KSE 521 Topic 10 Mun Yi

Structured Query Language (SQL) Part A. KSE 521 Topic 10 Mun Yi Structured Query Language (SQL) Part A KSE 521 Topic 10 Mun Yi 1 Agenda SQL Background Cape Codd Outdoor Sports SQL Select Statement Syntax Joining Tables 2 Structured Query Language Structured Query Language

More information

Institute of Aga. Microsoft SQL Server LECTURER NIYAZ M. SALIH

Institute of Aga. Microsoft SQL Server LECTURER NIYAZ M. SALIH Institute of Aga 2018 Microsoft SQL Server LECTURER NIYAZ M. SALIH Database: A Database is a collection of related data organized in a way that data can be easily accessed, managed and updated. Any piece

More information

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

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

More information

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

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

More information

2. In Video #6, we used Power Query to append multiple Text Files into a single Proper Data Set:

2. In Video #6, we used Power Query to append multiple Text Files into a single Proper Data Set: Data Analysis & Business Intelligence Made Easy with Excel Power Tools Excel Data Analysis Basics = E-DAB Notes for Video: E-DAB 07: Excel Data Analysis & BI Basics: Data Modeling: Excel Formulas, Power

More information

Exploring Microsoft Office Access 2007

Exploring Microsoft Office Access 2007 Exploring Microsoft Office Access 2007 Chapter 1: Finding Your Way Through a Database Robert Grauer, Keith Mulbery, Maurie Wigman Lockley Committed to Shaping the Next Generation of IT Experts. Copyright

More information

Chapter 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 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 information

COMP 430 Intro. to Database Systems

COMP 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 information

MySQL by Examples for Beginners

MySQL 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 information

DATABASE TECHNOLOGY. Spring An introduction to database systems

DATABASE TECHNOLOGY. Spring An introduction to database systems 1 DATABASE TECHNOLOGY Spring 2007 An introduction to database systems Kjell Orsborn Uppsala Database Laboratory Department of Information Technology, Uppsala University, Uppsala, Sweden 2 Introduction

More information

WHAT IS SQL. Database query language, which can also: Define structure of data Modify data Specify security constraints

WHAT IS SQL. Database query language, which can also: Define structure of data Modify data Specify security constraints SQL KEREM GURBEY WHAT IS SQL Database query language, which can also: Define structure of data Modify data Specify security constraints DATA DEFINITION Data-definition language (DDL) provides commands

More information

NCSS: Databases and SQL

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

More information

COGS 121 HCI Programming Studio. Week 03 - Tech Lecture

COGS 121 HCI Programming Studio. Week 03 - Tech Lecture COGS 121 HCI Programming Studio Week 03 - Tech Lecture Housekeeping Assignment #1 extended to Monday night 11:59pm Assignment #2 to be released on Tuesday during lecture Database Management Systems and

More information

Relational Model. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011

Relational Model. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011 Relational Model IT 5101 Introduction to Database Systems J.G. Zheng Fall 2011 Overview What is the relational model? What are the most important practical elements of the relational model? 2 Introduction

More information

Lesson 2. Data Manipulation Language

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

More information

Deepak Bhinde PGT Comp. Sc.

Deepak Bhinde PGT Comp. Sc. Deepak Bhinde PGT Comp. Sc. SQL Elements in MySQL Literals: Literals refers to the fixed data value. It may be Numeric or Character. Numeric literals may be integer or real numbers and Character literals

More information

MySQL. Prof.Sushila Aghav

MySQL. Prof.Sushila Aghav MySQL Prof.Sushila Aghav Introduction SQL is a standard language for storing, manipulating and retrieving data in databases. SQL is a part of many relational database management systems like: MySQL, SQL

More information

COMP 430 Intro. to Database Systems

COMP 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 information

SQL Structured Query Language Introduction

SQL Structured Query Language Introduction SQL Structured Query Language Introduction Rifat Shahriyar Dept of CSE, BUET Tables In relational database systems data are represented using tables (relations). A query issued against the database also

More information

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

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

More information

Slides by: Ms. Shree Jaswal

Slides by: Ms. Shree Jaswal Slides by: Ms. Shree Jaswal Overview of SQL, Data Definition Commands, Set operations, aggregate function, null values, Data Manipulation commands, Data Control commands, Views in SQL, Complex Retrieval

More information

Lecture 8. Database vs. Files SQL (I) Introduction to SQL database management systems (DBMS)

Lecture 8. Database vs. Files SQL (I) Introduction to SQL database management systems (DBMS) Lecture 8 SQL (I) Money are kept by boxes buried in the ground in the backyard. Money are kept in the bank 1 Source: system analysis and design methods, by Jeffrey L Whitten et al., 2 McGraw-Hill/Irwin,

More information

SQL. Char (30) can store ram, ramji007 or 80- b

SQL. Char (30) can store ram, ramji007 or 80- b SQL In Relational database Model all the information is stored on Tables, these tables are divided into rows and columns. A collection on related tables are called DATABASE. A named table in a database

More information

Working with Columns, Characters and Rows. Copyright 2008, Oracle. All rights reserved.

Working with Columns, Characters and Rows. Copyright 2008, Oracle. All rights reserved. Working with Columns, Characters and Rows What Will I Learn? In this lesson, you will learn to: Apply the concatenation operator to link columns to other columns, arithmetic expressions or constant values

More information

CIS 363 MySQL. Chapter 12 Joins Chapter 13 Subqueries

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

More information

Exploring Microsoft Office Access Chapter 2: Relational Databases and Multi-Table Queries

Exploring Microsoft Office Access Chapter 2: Relational Databases and Multi-Table Queries Exploring Microsoft Office Access 2010 Chapter 2: Relational Databases and Multi-Table Queries 1 Objectives Design data Create tables Understand table relationships Share data with Excel Establish table

More information

Microsoft MOS- Using Microsoft Office Access Download Full Version :

Microsoft MOS- Using Microsoft Office Access Download Full Version : Microsoft 77-605 MOS- Using Microsoft Office Access 2007 Download Full Version : http://killexams.com/pass4sure/exam-detail/77-605 QUESTION: 120 Peter works as a Database Designer for AccessSoft Inc. The

More information

Introduction to SQL. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011

Introduction to SQL. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011 Introduction to SQL IT 5101 Introduction to Database Systems J.G. Zheng Fall 2011 Overview Using Structured Query Language (SQL) to get the data you want from relational databases Learning basic syntax

More information

ENGG1811: Databases 1

ENGG1811: Databases 1 ENGG1811 Databases Computing for Engineers Why Databases How do they work? Views of databases, and Linking multiple databases Problems that databases try to deal with Table, field, record, keys, etc Different

More information

Today s Goals. CSCI 2910 Client/Server-Side Programming. More on Querying Records. Conditions. Conditions (continued) Conditions (continued)

Today s Goals. CSCI 2910 Client/Server-Side Programming. More on Querying Records. Conditions. Conditions (continued) Conditions (continued) CSCI 2910 Client/Server-Side Programming Topic: More on SQL Reading: PHP and MySQL, pp. 152 168 Today s Goals Today s lecture will improve our use of the SQL query "SELECT" by using: WHERE, BETWEEN, IN,

More information

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

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

More information

Basic SQL. Dr Fawaz Alarfaj. ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation

Basic SQL. Dr Fawaz Alarfaj. ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation Basic SQL Dr Fawaz Alarfaj Al Imam Mohammed Ibn Saud Islamic University ACKNOWLEDGEMENT Slides are adopted from: Elmasri & Navathe, Fundamentals of Database Systems MySQL Documentation MIDTERM EXAM 2 Basic

More information

Database Programming with SQL

Database Programming with SQL Database Programming with SQL 2-1 Objectives This lesson covers the following objectives: Apply the concatenation operator to link columns to other columns, arithmetic expressions, or constant values to

More information

The query language for relational databases Jef De Smedt

The query language for relational databases Jef De Smedt SQL The query language for relational databases Jef De Smedt Getting to know Βeta vzw, Antwerp 1993 computer training for unemployed 2000 computer training for employees Cevora vzw/cefora asbl ( Fr 15/9

More information

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity COSC 416 NoSQL Databases Relational Model (Review) Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Relational Model History The relational model was proposed by E. F. Codd

More information

SQL Overview. CSCE 315, Fall 2017 Project 1, Part 3. Slides adapted from those used by Jeffrey Ullman, via Jennifer Welch

SQL Overview. CSCE 315, Fall 2017 Project 1, Part 3. Slides adapted from those used by Jeffrey Ullman, via Jennifer Welch SQL Overview CSCE 315, Fall 2017 Project 1, Part 3 Slides adapted from those used by Jeffrey Ullman, via Jennifer Welch SQL Structured Query Language Database language used to manage and query relational

More information

Chapter 4. Basic SQL. SQL Data Definition and Data Types. Basic SQL. SQL language SQL. Terminology: CREATE statement

Chapter 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 information

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

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

More information

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data.

The DBMS accepts requests for data from the application program and instructs the operating system to transfer the appropriate data. Managing Data Data storage tool must provide the following features: Data definition (data structuring) Data entry (to add new data) Data editing (to change existing data) Querying (a means of extracting

More information

Operating systems fundamentals - B07

Operating systems fundamentals - B07 Operating systems fundamentals - B07 David Kendall Northumbria University David Kendall (Northumbria University) Operating systems fundamentals - B07 1 / 33 What is SQL? Structured Query Language Used

More information

CBSE Revision Notes Class-11 Computer Science (New Syllabus) Unit 3: Data Management (DM-1) Database

CBSE Revision Notes Class-11 Computer Science (New Syllabus) Unit 3: Data Management (DM-1) Database CBSE Revision Notes Class-11 Computer Science (New Syllabus) Unit 3: Data Management (DM-1) Database Database: A Database is an organized collection of facts. In other words we can say that it is a collection

More information

Getting Information from a Table

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

More information

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams

Where Are We? Next Few Lectures. Integrity Constraints Motivation. Constraints in E/R Diagrams. Keys in E/R Diagrams Where Are We? Introduction to Data Management CSE 344 Lecture 15: Constraints We know quite a bit about using a DBMS Start with real-world problem, design ER diagram From ER diagram to relations -> conceptual

More information