Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

create an application that allows the user to connect to a database and query the database. Write a Java query application that allows the user

create an application that allows the user to connect to a database and query the database. Write a Java query application that allows the user to connect to the books database and query the books database. Provide the following predefined queries: Select all authors from the Authors table Select a specific author and list all books for that author. Include each books title, year and ISBN. Display the appropriate data for each query.

CREATE DATABASE books;

USE books;

CREATE TABLE Authors ( AuthorID int NOT NULL AUTO_INCREMENT PRIMARY KEY, FirstName varchar(30) NOT NULL, LastName varchar(30) NOT NULL ) ; CREATE TABLE Titles ( ISBN varchar(20) NOT NULL PRIMARY KEY, Title varchar(100) NOT NULL, EditionNumber int NOT NULL, Copyright varchar(4) NOT NULL ) ;

CREATE TABLE AuthorISBN ( AuthorID int NOT NULL, ISBN varchar(20) NOT NULL, FOREIGN KEY (AuthorID) REFERENCES Authors(AuthorID), FOREIGN KEY (ISBN) References Titles(ISBN) ) ;

INSERT INTO Authors (FirstName,LastName) VALUES ('Harvey','Deitel') ; INSERT INTO Authors (FirstName,LastName) VALUES ('Paul','Deitel') ; INSERT INTO Authors (FirstName,LastName) VALUES ('Andrew','Goldberg') ; INSERT INTO Authors (FirstName,LastName) VALUES ('David','Choffnes') ;

INSERT INTO Titles (ISBN,Title,EditionNumber,Copyright) VALUES ('0131869000','Visual Basic 2005 How to Program',3,'2006') ; INSERT INTO AuthorISBN (AuthorID,ISBN) VALUES (1,'0131869000') ;

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

=+1 Where are the best places in the world to live (and work)?

Answered: 1 week ago

Question

=+Are you interested in working on global teams?

Answered: 1 week ago

Question

=+Do you want to work from home?

Answered: 1 week ago