Questions
There are four tables in the database. 1. students (sno, sname, sgender, sbirthday, class) - sno:...

There are four tables in the database.

1. students (sno, sname, sgender, sbirthday, class)

- sno: student number

- sname: student name

- sgender: male or female

- sbirthday: date of birth

- class: class number

- primary key: sno

2. courses (cno, cname, tno)

- cno: course number

- cname: course name

- tno: teacher number

- primary key, cno, tno

3. scores (sno, cno, grade)

- sno: student number

- cno: course number

- grade: grade

- primary key, sno, cno

4. teachers (tno, tname, tgender, tbirthday, title, department)

- tno: teacher number

- tname: teacher name

- tgender: teacher gender

- tbirthday: date of birth

- title: title of the teacher, e.g. professor, lecture, or TA

- department: department name, e.g. CS, EE.

Question 1: In the score table, find the student number that has all the grades in between 90 and 70.

Question 2: For all the courses that took by class 15033, calculate the average grade.

Question 3: Find the class number that has at least two male students.

Question 4: Find the teacher's name in CS and EE department, where they have different title. Return both name and title.

Question 5: Find the students, who took the course number "3-105" and have earned a grade, at least, higher than the students who took "3- 245" course. Return the results in a descending order of grade.

Question 6: Find the students, who took more than 1 course, and return the students' names that is not the one with highest grade.

Question 7: For each course, find the students who earned a grade less than the average grade of this course.

In: Computer Science

Case: A national football association needs to design a database to store information about all the...

Case:
A national football association needs to design a database to store information about all the players (identified by pid, with DOB, position and salary as attributes) registered under it, all the football clubs (identified by name, with city and asset as attributes) in the nation, and the stakeholders of each club (with name, age and percentage of holdings). Each player plays for one club, and each club has a captain player. Each stakeholder can only hold the shares of one club, and can be identified by name, given that his club is known.
Tasks:
1. Draw an ER diagram that captures this information.
2. Write SQL statements to create the corresponding relations and capture as many of the constraints as possible.
For any additional and reasonable assumptions made, please state clearly.

In: Computer Science

For Cloud Database Encryption Technology Based on Combinatorial Encryption You are required to research and report...

For Cloud Database Encryption Technology Based on Combinatorial Encryption

You are required to research and report on this topic according to the Detail of Question below.

A. understand in order to present three main parts:

1. Summary:

o Provide a 200-300 word summary of the paper under review, from the background to the results being presented, and further work proposed. Please do NOT copy the abstract into this space!

2. Main points:

o The main issues as you see them.

o This is different than the summary.

3. Strengths and Weaknesses:

o Provide some critical analysis of the paper under review, positive and/or negative.

In: Computer Science

The following tables form part of a database held in a relational DBMS: Hotel (hotelNo, hotelName,...

The following tables form part of a database held in a relational DBMS:

Hotel (hotelNo, hotelName, hotelAddress, country)

Room (roomNo, hotelNo, type, price)

Guest (guestNo, guestName, guestAddress, country)

Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo)

Write the SQL statements for the following questions:

1. List the rooms that are currently unoccupied at the Grosvenor Hotel, for:

(a) Use 2019-10-01 as today's date. Include all 'Grosvenor' hotels. List in hotelNo, roomNo order. Use NOT IN to perform the difference operation

(b) Use 2019-10-01 as today's date. Include all 'Grosvenor' hotels. List in hotelNo, roomNo order. Use NOT EXISTS to perform the difference operation.

(c) Use 2019-10-01 as today's date. Include all 'Grosvenor' hotels. List in hotelNo, roomNo order. Use LEFT JOIN to perform the difference operation.

(d) Use 2019-10-01 as today's date. Include all 'Grosvenor' hotels. List in hotelNo, roomNo order. Use MINUS to perform the difference operation.

In: Computer Science

Draw an ER diagram and write a database design outline for the following prompt: You run...

Draw an ER diagram and write a database design outline for the following prompt:

You run a coaching service to help high school students prepare for the SAT exam. You have a staff of coaches, each of which has an employee ID, an hourly rate (such as $20 per hour), and personal information consisting of their first name, last name, middle name/initial, address information, phone number, mobile phone number, and e-mail address. For each high school student, you want to keep similar personal information and a student ID number, date of birth, and expected date of graduation from high school. Coaching takes place in sessions, to each of which you assign a unique ID number. Each session consists of one coach and one student. In addition to being able to identify the coach and student involved in each session, you want to store its start date/time and end date/time.

In: Computer Science

Create the database with at least 10 employees and 2 managers are populated. Important: your name...

Create the database with at least 10 employees and 2 managers are populated. Important: your name should be in the employee table.

Write a Python code that can do the following:

    1) Take an employee ID from user

    2) Display the output of the SQL, select * from employee;

Improve the Python code above that can do the following:

    1) Take an employee ID from the user. Let it be idEntered.

    2) Get the departmentID for the given employeeID, idEntered. Let it be deptFound.

    3) Check if idEntered is in the table manager

    4) If yes, then execute: query = ("select * from employee where dID = %s; "). Note that since a variable deptFound is included in SQL, if it should be included, then use %s in SQL. And then declare a variable, data_tuple = (deptFound, ) in a separate line. Finally, execute the query cursor.execute(query, data_tuple).

    5) if No, simply execute the SQL: select * from employee where eid = %s; do the similarly way for idEntered as above

In: Computer Science

Give the tuple calculus expressions for each using the below schema: Make a database up if...

Give the tuple calculus expressions for each using the below schema: Make a database up if needed

SPERSON(EmpID, Name, Dept)

TRIP(TripID, EmpID, ToCity, StartDate, EndDate)

EXPENSE(ExpID, TripID, AccountID, Amount)

a) List the names and employee ID of a salesperson.

b) List employee ID and employee names that took a trip(s) to New York city.

c) List the names of all employees who have spent more than $700 on their trip.

d) List employees' names and their IDs that have never taken a trip.

e) List the names of all salespersons that have at least been on one trip.

In: Computer Science

Because the database server can cache and reuse ___________________ statements, they are more efficient than regular...

Because the database server can cache and reuse ___________________ statements, they are more efficient than regular SQL statements.

When you work with a result set, the ____________ identifies the current position in the result set.

You use the __________________ class to work with data returned from a SQL query.

What does the invoices result set contain after the code that follows is executed?
String sql = "SELECT InvoiceDate, InvoiceTotal "
           + "FROM Invoices WHERE InvoiceTotal > ?";
PreparedStatement ps = connection.prepareStatement(sql);
ps.setDouble(1, 100);

ResultSet invoices = ps.executeQuery();

a.

All rows from the Invoices table

b.

Rows from the Invoices table where InvoiceTotal is greater than 100

c.

Rows from the Invoices table where InvoiceTotal is greater than 0

d.

Rows from the Invoices table where InvoiceTotal is greater than 1

In: Computer Science

7. Using the provided schema of a Purchase Order Administration database, write the following queries in...

7. Using the provided schema of a Purchase Order Administration database, write the following queries in SQL. (In the schema, bold attributes are primary keys and italicized attributes are foreign keys.)

SUPPLIER (SUPNR, SUPNAME, SUPADDRESS, SUPCITY, SUPSTATUS)

SUPPLIES (SUPNR, PRODNR, PURCHASE_PRICE, DELIV_PERIOD)

PRODUCT (PRODNR, PRODNAME, PRODTYPE, AVAILABLE_QUANTITY)

PO_LINE (PONR, PRODNR, QUANTITY)

PURCHASE_ORDER (PONR, PODATE, SUPNR)

7d) Write a nested SQL query to retrieve the supplier number, supplier name, and supplier status of each supplier who has a higher supplier status than supplier number 21.

7e) Write a nested SQL query using the keyword IN to retrieve the supplier name of each supplier who supplies more than five products.

In: Computer Science

Just to be clear, I only want the answer to the third part The typedset question...

Just to be clear, I only want the answer to the third part

The typedset question pls.

Implement a class Box that represents a 3-dimensional box. Follow these guidelines:


constructor/repr

A Box object is created by specifying calling the constructor and supplying 3 numeric values
for the dimensions (width, height and length) of the box.
These measurements are given in inches.
Each of the three dimensions should default to 12 inches.
The code below mostly uses integers for readability but floats are also allowed.
You do not need to do any data validation.
See below usage for the behaviour of repr.
There are no set methods other than the constructor.


>>> b = Box(11,12,5.5)
>>> b
Box(11,12,5.5)
>>> b2 = Box()
>>> b2
Box(12,12,12)

calculations
Given a Box , you can request its volume and cost.
volume - return volume in cubic inches
cost - returns the cost of a box in dollars. A box is constructed out of cardboard that costs
30 cents per square foot. The area is the total area of the six sides (don't worry about
flaps/overlap) times the unit cost for the cardboard.
If you look up formulas, cite the source in a comment in your code.

>>> b.volume()
726.0
>>> b.volume() == 726
True
>>> b.cost()
1.0770833333333334
>>> b2.volume()
1728
>>> b2.cost()
1.8
>>> b2.cost() == 1.8
True

comparisons

Implement the == and <= operators for boxes.
== - two boxes are equal if all three dimensions are equal (after possibly re-orienting).
<= - one box is <= than another box, if it fits inside (or is the same) as the other (after
possibly re-orienting). This requires that the boxes can be oriented so that the first box has
all three dimensions at most as large as those of the second box.

The above calculations must allow the boxes to be re-oriented. For example
Box(2,3,1)==Box(1,2,3) is True . How many ways can they be oriented? What is a good
strategy to handle this?
You may need to look up the names of the magic/dunder methods. If so, cite the source.
warning: I will run more thorough complete tests, so make sure you are careful!

>>> Box(1,2,3)==Box(1,2,3)
True
>>> (Box(1,2,3)==Box(1,2,3)) == True
True
>>> Box(2,3,1)==Box(1,2,3)
True
>>> Box(4,3,1)==Box(1,2,6)
False
>>> Box(1,2,3) <= Box(1,2.5,3)
True
>>> Box(1,3,3) <= Box(1,2.5,3)
False
>>> Box(3,1,2) <= Box(1,2.5,3)
True
>>> Box(1,2,3)<=Box(1,2,3)
True
>>>

boxThatFits

Write a standalone function boxThatFits that is a client of (uses) the Box class.
This function will accept two arguments, 1) a target Box and, 2) a file that contains an
inventory of available boxes.
The function returns the cheapest box from the inventory that is at least as big as the target
box.
If no box is large enough, None is returned.
If there is more than one that fits available at the same price, the one that occurs first in the
file should be returned.

>>> boxThatFits(Box(10,10,10),"boxes1.txt")
Box(10,10,10)
>>> b = boxThatFits(Box(10,10,10),"boxes1.txt")
>>> b.cost()
1.25
>>> boxThatFits(Box(12,10,9),"boxes2.txt")
Box(10,10,13)
>>> boxThatFits(Box(14,10,9),"boxes2.txt")
Box(11,15,10)
>>> boxThatFits(Box(12,10,13),"boxes2.txt")
Box(12,14,10)
>>> boxThatFits(Box(16,15,19),"boxes1.txt")
>>>

TypedSet

Write a class TypedSet according to these specifications:
TypedSet must inherit from set . Remember that this means you may get some of the
required functionality for free.
TypedSet acts like a set (with limited functionality) except that once the first item is added,
its contents are restricted to items of the type of that first item. This could be str or int or
some other immutable type.

# this is helpful, not something you need to write any code for
>>> type("a")
<class 'str'>
>>> x = type(3)
>>> x
<class 'int'>
>>> x==str
False
>>> x==int
True

constructor/repr
Do not write __init__ or __repr__ . When you inherit from set you will get suitable
versions.
Assume that the constructor will always be used to create an empty TypedSet (no arguments
will be passed)

add/getType
add functions like set.add , except that
the first object added to a TypedSet determines the type of all items that will be
subsequently added to the set
after the first object is added, any attempt to add an item of any other type raises a
WrongTypeError
getType returns the type of the TypedSet or None if no item has ever been added
Note: the sorted function is used for the below examples (and doctest) to make sure that
the results always appear in the same order.
Hint: you will need to make use of Python's type function. It returns the type of an object.
Of course, the value it returns can also be assigned to a variable/attribute and/or compared
to other types like this:

>>> ts = TypedSet()
>>> ts.add("a")
>>> ts.add("b")
>>> ts.add("a")
>>> ts.add(3) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
WrongTypeError: 3 does not have type <class 'str'>
>>> sorted(ts)
['a', 'b']
>>> ts = TypedSet()
>>> ts.getType()
>>> ts.add(2)
>>> ts.add("a") #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
WrongTypeError: a does not have type <class 'int'>
>>> ts.getType()
<class 'int'>
>>> ts.getType()==int
True
>>>

remove
remove functions as it would with a set

>>> ts = TypedSet()
>>> ts.add(4.3)
>>> ts.add(2.1)
>>> ts.add(4.3)
>>> ts.remove(4.3)
>>> ts.remove(9.2) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
KeyError: 9.2
>>> ts
TypedSet({2.1})

update
update functions like set.update , given a sequence of items, it adds each of the them
but, this update will raise a WrongTypeError if something is added whose type does not
match the first item

keep in mind that the TypedSet may not yet have been given an item when update is called

>>> ts = TypedSet()
>>> ts.add(3)
>>> ts.update( [3,4,5,3,4,4])
>>> sorted( ts )
[3, 4, 5]
>>> ts.update(["a","b"]) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
WrongTypeError: a does not have type <class 'int'>
>>>
>>>
>>> ts = TypedSet()
>>> ts.update( ["a","b",3]) #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
WrongTypeError: 3 does not have type <class 'str'>
>>>

The | operator is the "or" operator, given two sets it returns their union, those elements
that are in one set or the other. (It is already defined for the set class.)
accepts two arguments, each a TypedSet , neither is changed by |
returns a new TypedSet whose contents are the mathematical union of the supplied
arguments
as usual, raises a WrongTypeError if the two TypedSet 's do not have the same type
remember to cite anything you need to look up

>>> s1 = TypedSet()
>>> s1.update([1,5,3,1,3])
>>> s2 = TypedSet()
>>> s2.update([5,3,8,4])
>>> sorted( s1|s2 )
[1, 3, 4, 5, 8]
>>> type( s1|s2 ) == TypedSet
True
>>> sorted(s1),sorted(s2)
([1, 3, 5], [3, 4, 5, 8])
>>>
>>> s1 = TypedSet()
>>> s1.update([1,5,3,1,3])
>>> s2 = TypedSet()
>>> s2.update( ["a","b","c"] )
>>> s1|s2 #doctest: +IGNORE_EXCEPTION_DETAIL
Traceback (most recent call last):
...
WrongTypeError: b does not have type <class 'int'>

>>> sorted(s1),sorted(s2)
([1, 3, 5], ['a', 'b', 'c'])

Just to be clear, I only want the answer to the third part

The typedset question pls.

In: Computer Science