Given the tables create table T (A int primary key, B int); create table U (C int primary key, A int, foreign key(A) references T(A) ); Table T contains 100 rows and table U contains 200 rows. A common mistake made by students is to do a join and assuming the database will supply the join predicate. A student does the query SELECT T.A, T.B, U.C FROM T, U; The student does not get an error message but gets a large result set. How many rows are in the result set?
Q: 1. Write a query to create a table employee with Emp No (4), Ename, Department, and Salary and…
A: answers: 1> part1 create table employee ( EmpNo int, Ename varchar(255), Department varchar(255),…
Q: Cmployee employee_id INT last name VARCHAR(25) first name VARCHAR(15) email VARCHAR(45) •dept code…
A: Keys are used to assign an identity to the attributes present in a relation.
Q: Consider the query:select *from r, swhere upper(r.A) = upper(s.A);where “upper” is a function that…
A: Consider the given query with upper function. It has been assumed that the before finding a plan…
Q: Figure Q3.13 The Ch03_VENDINGCO database tables Table Name: BOOTH BOOTH _PRODUCT BOOTH…
A: The relational algebra formula to apply an INTERSECT relational operator to the given tables is as…
Q: A manager has a list of items that have been sorted according to an item ID. Some of them are…
A: Given is an excel data, where student wants to find a number of duplicates as they occur.
Q: Write an SQL query based on the described database for a student exchange program coordinator. To…
A: Introduction:- Below is the complete solution with explanation in detail. Below is the SQL query for…
Q: If P is the primary key of schema R, we must have P -> R. True or
A: If P is the primary key of schema R, we must have P -> R. --> True
Q: Given relation R(A,B,C,D,E) with dependencies АВ -> с CD -> E DE -> B The candidate key of this…
A: Candidate Key is minimal set of attributes of a relation which can be used to identify a tuple…
Q: Write Queries in Relational Algebra = sleer (r) = From T =where Op(7) Consider the following schema:…
A: Solution: Given,
Q: Let R and S be two relations with the following schema: R (P.Q. R1, R2, R3) S (P.Q S1, S2) Where (P,…
A: Let R and S be two relations with the following schema R(P,Q−−−−,R1,R2,R3)R(P,Q_,R1,R2,R3)…
Q: Given the following Theatre Database form: No.of seats:500 Owner:…
A: Normalization of data is method which is used to organize the data in the database and it applies a…
Q: Print all the students by the name order desc by the gpa. Print all the computer sciences courses,…
A: As per our company guidelines, we are supposed to answer three subparts of a post and kindly…
Q: We need to create a database for the Circulation Department of a public library. The database will…
A: Database schema: The database schema would have the following structure (primary keys are italicised…
Q: Given the database schema R(A, B, C), and a relation r on the schema R, write an SQL query to test…
A: Functional dependency An attribute C does have a functional dependency on valid instances of…
Q: BOOK Book_id Title Publisher_name BOOK AUTHORS Book_id Author_name PUBLISHER Name Address Phone…
A: Objective: The relations for the library database are provided specifying the key attributes, i.e.…
Q: Consider the following database: Students name rim sara milad tarek lastname age 19 18 21 18 Select…
A:
Q: Consider the following sales relational database schema for sales. Item (ItemNo: integer,…
A: SELECT i.itemName, i.type FROM item i INNER JOIN Sales s ON…
Q: Given an object context named mmaBooks that contains an entity class named Customer and an entity…
A: Entity Framework: The Entity Framework acts as a layer between an application's database and its…
Q: Draw relational model
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: The below ERD has been implemented in a SQL database. What will the result be of each of the below…
A: INSERT is a keyword used in SQL to insert a record into the table
Q: Suppose a school wants to store the data of teachers and the subjects they teach. They create a…
A: Normalization is the process of reducing duplicity from a relation or set of relations. Redundancy…
Q: Consider the bank database of Figure 16.9, where the primary keys are underlined. Construct the…
A: Following is the nested query that retrieves the branch name with B and the account number with…
Q: 2 Q3: Find the top 2 accounts with the maximum number of unique patients on a monthly basis. Patient…
A: select * from ( select * , row_number() over (partition by month,AccountID order by count(distinct…
Q: Figure Q3.13 The Ch03_VENDINGCO database tables Table Name: BOOTH BOOTH _PRODUCT BOOTH…
A: In the given problem, two tables are given, and we need to create the table that results from…
Q: It may be advantageous to keep the join as a materialized view if a parallel data-store is used to…
A: materialized a view is a database object that contains the results of a query. For example, it may…
Q: Implement the following ER model and sample data using Oracle SQL Developer and your CDM Oracle…
A: This is the implementation of the given ER model: CREATE TABLE STUDENTS(StudentID NUMBER(5) PRIMARY…
Q: Create a temporary table for V1 b) Create the appropriate trigger(s) on R that will keep V1 current…
A: One implementation technique of a view is as a temporary table. That creates the challenge for the…
Q: Consider the relation R = {F, T, D, N, S} and the set of functional dependencies K = {F¬D, {D, T}…
A: Answer : { T , N } is a key of Relation R .
Q: Consider the following database: Students Roster name lastname age ID ID major absence rim ismail 19…
A:
Q: 1st Normal Form (1NF) Consider the Students table, with the primary key underlined, and the…
A: First Normal Form (1NF): => If a table includes a composite or multi-valued attribute, it…
Q: A table called "game1" contains three columns and twenty rows, but "game2 has the same column as…
A: Tip It is a list of data linked together and stored in a database in the form of a table.As in…
Q: Consider an employee database with two relationsemployee (employee_name, street, city)works…
A: “avg_salary()” function: A company name is passed as an argument to the function “avg_salary()”.…
Q: It may be advantageous to keep the join as a materialized view if a parallel data-store is used to…
A: Introduction: Consider storing the given two relations in a cloud data storage system.…
Q: Consider an employee database with two relationsemployee (employee name, street, city)works…
A: A single value is returned by an aggregate function, which executes a calculation on a collection of…
Q: Let the following database schema be given. Person(idnumber, name, dob, mother, father) primary key…
A: a) Will use CTE to prepare a hierarchical result set WITH #results AS(SELECT idnumber,nameFROM…
Q: m university database , Write the following queries in SQL Find the titles of courses in the Comp.…
A: For the first question , we are assuming that there exist another table named as Table (or relation…
Q: Consider the Library database given below. Write the following queries in SQL, assuming that the…
A: IF (OBJECT_ID('tempdb..#member') IS NOT NULL) DROP TABLE #member CREATE TABLE #member…
Q: TRUE OR FALSE In the Relational Data Model, Referential Integrity Constraint is a special kind/case…
A: Solution: In the Relational Data Model, Referential Integrity Constraint is a special kind/case of…
Q: Modify the recursive query in Figure 5.16 to define a relationprereq_depth(course_id, prereq_id,…
A: The given recursive query has to be modified so that the depth attribute denotes the level of…
Q: How can you implement 1:M relationship in a database composed of two tables ? Explain with example.
A: One-to-Many Relationship: When one record in a database table is associated with more than one…
Q: "natural join" in a relational database takes two tables of lnformation and combines entries from…
A: C = [ {A38182818,Spring2021,Math230,01,Su,A38182818},…
Q: Consider the following database table named water_schemes : water - schemes scheme_no district_name…
A:
Q: A table called "game1" contains three columns and twenty rows, but "game2" has the same column as…
A: A table is a collection of related data recorded in a table format in a database. In relational and…
Q: The following PEOPLE relation keeps information about people such as their social security number,…
A: Answer to the above question is in step2.
Q: Write an SQL statement, using the inner join construct, that will, for the lecturer John Smith, list…
A: SQL queries approach: 1- For the first question needs to fetch records by inner join and…
Q: Consider the following two tables R and S with their instances: R S B с E a XNXXBD V5 233 a b A b с…
A: Please check step 2 for the answer. I have provided the correct answer. Thank you. Do upvote.
Q: Generate the candidate item set and frequent item set by taking any data set, follow the given…
A:
Step by step
Solved in 2 steps
- There are three tables in this database (see image). Write MYSQL code for: (1) Create a trigger “insert_inventory” on table “Inventory”. The trigger is fired after a row is inserted in table “Inventory”. After a row is inserted in table “inventory”, the “itemid”, the insertion time, and the action is inserted in table “Inventory_history”. The action is set to ‘add an item’. The oldprice is set to null. Test your trigger by inserting a row into Inventory and displaying the contents of Inventory_history. (2) Create a trigger “change_quantity” on table “Transaction”. The trigger is fired after a row is inserted in table “Transaction”. After a row is inserted in table “Transaction”, update the “quantity” in table “Inventory”. For example, if 3 iWatch are sold, then the quantity of iWatch in table “Inventory” is decreased by 3. Test your trigger by inserting a row into Transaction and displaying the contents of the relevant row in Inventory. (3) Create a trigger “change_price” on table…SQL: Create a SQL query that uses an uncorrelated subquery and no joins to display the descriptions for products provided by a vendor in area code 615. Remember, the main difference between a correlated subquery and uncorrelated subquery is that, in a correlated subquery, the inner query is dependent upon the outer query, while, with an uncorrelated query, the inner query does not depend upon the outer query. Instead, it runs just once. You should NOT use union, minus, or intersect in this query. The outer query will use the PRODUCT table and the inner query will use the VENDOR table [hint: you should have 9 records of output]. My code: select p_descript from product where (select v_areacode from vendor where v_areacode = '615' ; I am getting this error, problem is I can't see what is missing any assistance is appreciated. ORA-00936: missing expression2. Get the Groups As new students begin to arrive at college, each receives a unique ID number, 1 to n. Initially, the students do not know one another, and each has a different circle of friends. As the semester progresses, other groups of friends begin to form randomly. There will be three arrays, each aligned by an index. The first array will contain a queryType which will be either Friend or Total. The next two arrays, students1 and students2, will each contain a student ID. If the query type is Friend, the two students become friends. If the query type is Total, report the sum of the sizes of each group of friends for the two students.
- Q2: Design Database for the following scenario and Write SQL queries. Create an ERD for the following scenario. Suppose there is a grocery store near your house. Following can be considered for ERD: A grocery store may have more than one employee. A grocery store has exactly one manager. The manager has one or more sales men working under him. Grocery store has more than one portion for the products. • Each product has a barcode, name, expired date. Many customers can busy many products, but each product is bought by only one customer. Each customer will get an invoice for his /her purchase. The bill invoice has an id.In java create an application to manage your data base information the database is already created in mysql tables, the tables are fill, So the user can use your database application user friendly Retrieve all data: Given a table name, retrieve all data from the table and present it to the user. Average: Given a table name and a column name, return the average of the column. Here the assumption is that the column type will be numeric (e.g., cost column). Insert: Given a table name, your program should show the column names of that table and ask the users to input new data to the table. In case of errors, your program should directly show the MySQL errors to the users. Assumption 1: Users will enter data according to the database constraints. Assumption 2: Users will input one record at a time. Delete: Given a table name, your program should show the column names of that table and ask the users to input data that they want to delete. Assumption 1: Users will enter data according to the…In this database we have users that can be two types students or instructors. They have groups and memberships. Any user can post and the post type can be video, photo or text. Here is the table structure: CREATE TABLE USER_ ( USER_ID INT NOT NULL AUTO_INCREMENT, CREATE_DATE DATE NOT NULL, PROF_DESC VARCHAR (100), PROF_PIC VARCHAR(40), LOCATION VARCHAR (40) NOT NULL, PRIMARY KEY (USER_ID) ); CREATE TABLE USER_INFO( USER_ID INT NOT NULL, SU_EMAIL CHAR(18), USER_FNAME VARCHAR(15), USER_LNAME VARCHAR (15), USER_DOB DATE, USER_GENDER CHAR(1), PRIMARY KEY (USER_ID), FOREIGN KEY (USER_ID) REFERENCES USER_(USER_ID) ON UPDATE CASCADE ); CREATE TABLE STUDENT ( SU_ID INT NOT NULL, USER_ID INT NOT NULL, YEAR_ VARCHAR (10), MAJOR VARCHAR (20), LOCATION VARCHAR (40) NOT NULL, PRIMARY KEY (SU_ID), FOREIGN KEY (USER_ID) REFERENCES USER_(USER_ID) ON UPDATE CASCADE ); CREATE TABLE INSTRUCTOR ( SU_ID INT NOT NULL, USER_ID INT NOT NULL, DEPARTMENT VARCHAR (40), INSTR_TYPE VARCHAR (40),…
- Suppose a qüery sumServ sums the quantities in the CustomerBillitem table and a query sumWaste sums the quantities in the FoodWaste table. For the purpose of summing the quantities in sumServ and sumWaste, the following query design needs: sumserv sunWaste Storeio Storeib FoodiD Foodio Sumoruantity SumorQuantity sen wastew 1) No join from servWk to wasteWk 2) A left outer join on FoodiD 31 Left outer joins on StorelD and FoodID 4) All left outer joinsWe need to create a database for the Circulation Department of a public library. The database will store information about the patrons, books, and circulation. It contains the following: 4 tables for the database: PATRON, BOOK_COPY, BOOK, and CHECKOUT. (Since a book may have multiple copies that may be purchased by the library at different time, it is better to have a BOOK_COPY table to avoid unnecessary data redundancy.) The data in the tables are as follows: PATRON table records a patron’s ID, name, address, phone number, and email address. BOOK table contains information such as author, title, publication date, subject, language, and a unique identifier (It can be the ISBN of the book) for each book. BOOK_COPY table records a unique identifier for each copy of a book, the date of purchase, and the identifier of the book from the BOOK table. CHECKOUT table records the date of check-out, patron’s ID, the…We need to create a database for the Circulation Department of a public library. The database will store information about the patrons, books, and circulation. It contains the following: 4 tables for the database: PATRON, BOOK_COPY, BOOK, and CHECKOUT. (Since a book may have multiple copies that may be purchased by the library at different time, it is better to have a BOOK_COPY table to avoid unnecessary data redundancy.) The data in the tables are as follows: PATRON table records a patron’s ID, name, address, phone number, and email address. BOOK table contains information such as author, title, publication date, subject, language, and a unique identifier (It can be the ISBN of the book) for each book. BOOK_COPY table records a unique identifier for each copy of a book, the date of purchase, and the identifier of the book from the BOOK table. CHECKOUT table records the date of check-out, patron’s ID, the…
- We need to create a database for the Circulation Department of a public library. The database will store information about the patrons, books, and circulation. It contains the following: 4 tables for the database: PATRON, BOOK_COPY, BOOK, and CHECKOUT. (Since a book may have multiple copies that may be purchased by the library at different time, it is better to have a BOOK_COPY table to avoid unnecessary data redundancy.) The data in the tables are as follows: PATRON table records a patron’s ID, name, address, phone number, and email address. BOOK table contains information such as author, title, publication date, subject, language, and a unique identifier (It can be the ISBN of the book) for each book. BOOK_COPY table records a unique identifier for each copy of a book, the date of purchase, and the identifier of the book from the BOOK table. CHECKOUT table records the date of check-out, patron’s ID, the…2. Write a method named query2 that uses JDBC to execute a SELECT query to List, for a provided Language, the movies for that language (ID, Title, Release Date) together with the Number of actors that act on each of them. Note if a movie has 0 actors, it should appear with a 0 (For example, film with id 5, in Spanish, has not actors) Example of output for the parameter Spanish': film_id title 2 release_year Number of actors ACE GOLDFINGER AFRICAN EGG 2006 5 2006 10 ALADDIN CALENDAR 2006 3 Use a PreparedStatement with a parameter for the LanguageName and filter the query results to only return rows tied to that Language. b. Pretty-print the results to the console (One line per row in readable aligned columns) This would be invoked on the command line as a. с. java ser322.JdbcLab query2A manager has a list of items that have been sorted according to an item ID. Some of them are duplicates. She wants to add a code to the database that assigns a 1 to the item if it is unique, and if there are duplicates, assigns the number of the duplicate. An example is shown below. The first two items are unique, so the repeat code is 1. However, Item ID 37695 is listed six times, so the codes are assigned from 1 to 6, and so on. Explain how to assign the correct code using an IF statement Item ID Repeat Code35080 135222 137695 137695 237695 337695 437695 537695 637712 137722 137757 137757 2 In cell B2 enter 1, and then type a formula into cell B3, followed by dragging the formula down column B until it aligns with the last row in the Item ID column. Which of the following is the correct formula to type into cell B3?