lec16 - COMP201 Java Programming Topic 16: Database...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP201 Java Programming Topic 16: Database Connectivity JDBC Reading: Chapter 4, Volume 2
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP201 Topic 16 / Slide 2 Outline Database basics Connecting to a database with JDBC Querying and manipulating databases with JDBC
Background image of page 2
COMP201 Topic 16 / Slide 3 Database Basics A (relational) database: a collection of tables Attributes: names of columns Records or entries: rows Example: testdb.mdb 4 tables
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP201 Topic 16 / Slide 6 Database Basics Database management systems (DBMS): allow user to manipulate data Many DBMS available. We will use Microsoft Access , which comes with Microsoft Office .
Background image of page 6
COMP201 Topic 16 / Slide 7 Database Basics Query: Find all books by “Fox, David”, list author name, title, publisher name and price The query involves all four tables
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COMP201 Topic 16 / Slide 8 Database Basics Update: Modify records Insert new records Delete records Create new Table ….
Background image of page 8
COMP201 Topic 16 / Slide 9 Database Basics The structured query language (SQL): Standard language for accessing databases:. Query database using SELECT statements Select all elements in the Books table: SELECT * FROM Books Select only some columns SELECT ISBN, Price, Title FROM Books
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Database Basics Select from multiple tables Find all books by “Fox, David”, list author name, title, publisher name and price SELECT Authors.Name, Books.Title, Publishers.Name, Books.Price FROM Books, Authors, Publishers, BooksAuthors WHERE Publishers.Publisher_Id = Books.Publisher_Id AND Books.ISBN = BooksAuthors.ISBN AND BooksAuthors.Author_Id = Authors.Author_Id AND Authors.Name= 'Fox, David' When we select from multiple tables, a joint table is formed. The joint table consists of ALL possible combinations of rows from all the tables. The first three conditions in the
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 26

lec16 - COMP201 Java Programming Topic 16: Database...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online