Question

In: Physics

Design the database using the ER approach. Then using Java and SQL, implement the following functionality:...

Design the database using the ER approach. Then using Java and SQL, implement the following functionality:

Implement a button called “Initialize Database”. When a user clicks it, all necessary tables will be created (or recreated) automatically, with each table be populated with at least 10 tuples so that each query below will return some results. All students should use the database name “sampledb”, username “john”, and password “pass1234”.

Implement a user registration and login interface so that only a registered user can login into the system.

Create the functionality to assign three reviewers to a paper.

Solutions

Expert Solution

CODE:

Create table paper
(
paperid integer,
title VARCHAR(50),
abstract VARCHAR(250),
pdf VARCHAR(100),
primary key (paperid)
)

Create table author
(
email VARCHAR(100),
name VARCHAR(50),
affiliation VARCHAR(100),
primary key(email)
)

CREATE table write
(
paperid integer,
email varchar(50),
order integer,
Primary key(paperid, email),
foreign key paperid references paper,
foreign key email references autor
)

create table pcmember
(
email VARCHAR(50),
name VARCHAR(20),
primary key (email)
)

create table review
(
reportid integer,
sdate DATE,
comment VARCHAR(250),
recommendation CHAR(1),
paperid integer,
email VARCHAR(100),
unique(paperid, email),
foreign key paperid references paper,
foreign key email references pcmember)

CREATE Assertion 3pc

CHECK NOT EXISTS
(
SELECT * FROM Papers P
WHERE 3 <>
(
SELECT COUNT(*)
FROM Review R
WHERE R.paperid = P.paperid
)
)

CREATE ASSERTION atmostfivepapers

CHECK NOT NOT EXISTS
(
SELECT * FROM pcmember P
WHERE 5 <
(
SELECT *
FROM review R
WHERE R.email = P.email
)
)


Related Solutions

Draw an ER diagram with these attributes ( ER diagram for SQL for a library database)...
Draw an ER diagram with these attributes ( ER diagram for SQL for a library database) DRAW ER DIAGRAM AS ONE FULL LIBRARY SYSTEM, NOT DIFFERENT FOR EACH ATTRIBUTE. Attributes :           Customer Cust_ID: key identifier, required, simple, single valued Cust_Name{ first name, last name}: Key Identifier, simple;composite, multivaried   Address{street, city,zip,state}: Customer address, required, composite, single can be derived from zip (placeholder, there should be another attribute here to represent the books taken out by the customer. Not sure.)           Inventory Book_ID:...
Draw an ER diagram with these attributes ( ER diagram for SQL for a library database)...
Draw an ER diagram with these attributes ( ER diagram for SQL for a library database) Attributes :           Customer Cust_ID: key identifier, required, simple, single valued Cust_Name{ first name, last name}: Key Identifier, simple;composite, multivaried   Address{street, city,zip,state}: Customer address, required, composite, single can be derived from zip (placeholder, there should be another attribute here to represent the books taken out by the customer. Not sure.)           Inventory Book_ID: Key identifier, required, simple single valued Book_Name: Key identifier, required, simple, single-valued Genre:...
Design and implement a relational database application of your choice using MS Workbench on MySQL a)...
Design and implement a relational database application of your choice using MS Workbench on MySQL a) Declare two relations (tables) using the SQL DDL. To each relation name, add the last 4 digits of your Student-ID. Each relation (table) should have at least 4 attributes. Insert data to both relations (tables); (15%) b) Based on your expected use of the database, choose some of the attributes of each relation as your primary keys (indexes). To each Primary Key name, add...
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft...
Create the actual database using SQL syntax. This is completed using a Database Application (i.e Microsoft Access, Oracle, or MySQL) as indicated by your professor. After creating the database – populate it with some data (could be made up). SQL syntax and the DB application will be discussed and taught in class. This is the final deliverable of the group project. Assignment is due by the due date as indicated by your professor. *Make sure to submit the completed database...
Bank Accounts in Java! Design and implement a Java program that does the following: 1) reads...
Bank Accounts in Java! Design and implement a Java program that does the following: 1) reads in the principle 2) reads in additional money deposited each year (treat this as a constant) 3) reads in years to grow, and 4) reads in interest rate And then finally prints out how much money they would have each year. See below for formatting. Enter the principle: XX Enter the annual addition: XX Enter the number of years to grow: XX Enter the...
Design an ER Diagram for the given problem. Link the tables that are related and implement...
Design an ER Diagram for the given problem. Link the tables that are related and implement your design using MySQL. Insert at least a minimum of 5 records. Ensure that the data to be added are related to other tables. Post here the screenshot of the following: Entity Relationship Diagram with attributes, PK, and FK. Use the "describe" command to view the structure of the tables. Use the "select" command to view the contents of the tables. Company ABC has...
Create a database and design an ER diagram for the given question. Must link the related...
Create a database and design an ER diagram for the given question. Must link the related tables then implement the design using MySQL. Insert at least 5 records. Ensure that the data to be added are related to other tables. Follow this format in creating the database and table: Database format: databasename_yourname Table format: tablename_yourname QUESTION: Company ABC has the following business rules. A department employs many employees, but each employee is employed by only one department. A division operates...
Write the SQL queries that accomplish the following tasks using the AP Database 9. Write a...
Write the SQL queries that accomplish the following tasks using the AP Database 9. Write a select statement to show the invoicelineitemdescriptions that have the total invoicelineitemamount >1000 and the number of accountno is >2. 10. Write a select statement that returns the vendorid, paymentsum of each vendor, and the number of invoices of each vendor, where paymentsum is the sum of the paymentotal column. Return only the top ten vendors who have been paid the most and the number...
Database Design and SQL The following relations keep track of airline flight information: Flights (flno: integer,...
Database Design and SQL The following relations keep track of airline flight information: Flights (flno: integer, from : string, to: string, distance: integer, departs: time, arrive: time, price: integer) Aircraft (aid: integer, aname : string, cruisingrange: integer) Certified (eid: integer, aid: integer) Employees (eid: integer, ename : string, salary: integer) The Employees relation describe pilots and other kinds of employees as well. Every pilot is certified for some aircraft and only pilots are certified to fly. Based on the schemas,...
Please use the books database pasted under question 4 to design the following SQL queries. Use...
Please use the books database pasted under question 4 to design the following SQL queries. Use any method such as subqueries, equi-join/inner-join, outer join, EXISTS 1. Find the name(s) of the publisher(s) who have published the computer book. 2. Find the name(s) of the author(s) that have authored more than one books. 3. Find the name(s) of the publisher(s) who published the least expensive book. 4. Find the name(s) of the author(s) who wrote the book with the greatest number...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT