Question

In: Computer Science

Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth...

  1. Create a table ‘StudentInfo’ with following fields:
    1. ID
    2. First Name
    3. Last Name
    4. SSN
    5. Date of Birth
  2. Create a table ‘ClassInfo’ table:
    1. ID
    2. Class Name
    3. Class Description
  3. Create a table ‘RegisteredClasses’ table:
    1. StudentID
    2. ClassID

The RegisteredClasses table should have a foreign key relationship to StudentInfo and ClassInfo tables for the respective IDs. Also the IDs in StudentInfo and ClassInfo need to be primary keys.

When you submit the file your email should also contain the following SQL Queries:

  1. Query to show all records from StudentInfo whose first name is John
  2. Query to show all records from StudentInfo whose last name is Doe
  3. Query to delete all records from from ClassInfo where class name starts with ‘ISAM'

Solutions

Expert Solution

  • Create a Table StudentInfo

Create table StudentInfo(
StudentID varchar(10) NOT NULL,
FirstName varchar(20),
LastName varchar(20),
SSN int,
DateofBirth DATE,
PRIMARY KEY (StudentID)
);

  • Create a Table ‘ClassInfo’

  Create table ClassInfo(
ClassID varchar(10) NOT NULL,
ClassName varchar(4),
ClassDescription varchar(20),
PRIMARY KEY ( ClassID)
);

  • Create a table ‘RegisteredClasses’​​​​​​​

Create table RegisteredClasses(
FOREIGN KEY (StudentID) REFERENCES Persons(StudentID),
FOREIGN KEY (ClassID) REFERENCES Persons(ClassID)
);

  • Query to show all records from StudentInfo whose first name is John

Select * from StudentInfo
where FirstName="John"

  • Query to show all records from StudentInfo whose last name is Doe

Select * from StudentInfo
where FirstName="Doe"

  • Query to delete all records from from ClassInfo where class name starts with ‘ISAM'

Delete from ClassInfo
WHERE (ClassName REGEXP '^ISAM')


Related Solutions

You have a table called scholar where there are two fields id and create date. You...
You have a table called scholar where there are two fields id and create date. You want to create an ETL process that loads the data from scholar table into the big data platform. What are the different things that you will put on a requirement document for the developer to write code and implement the solution?
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department...
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department Phone # 0001 John Smith jsmith Accountant 1300 West st 5775 Accounting 2100 8/1998 407-366-5700 0002 Brian Miller badams Admin Assistant 1552 Palm dr 5367 Human resource 2300 4/1995 407-366-5300 0003 James Miller miller Inventory Manager 2713 Buck rd 5432 Production 2520 8/1998 407-366-5400 0004 John Jackson jackson_sam Sales Person 433 tree dr 5568 Sales 2102 6/1997 407-366-5500 0005 Robert Davis Davis Manager 713...
Create a table with two columns. Name the table First Initial _ Last Name (e.g. John...
Create a table with two columns. Name the table First Initial _ Last Name (e.g. John Dow will create table j_dow). You have to audit all DML statements on your table. To do this you write two triggers: 1. To log any DML statements that users might run on this table. The results must be stored in the First Initial _ Last Name _ Log table (e.g. John Dow will create table j_dow_log). The table should have unique event ID,...
C# (Thank you in advance) Create an Employee class with five fields: first name, last name,...
C# (Thank you in advance) Create an Employee class with five fields: first name, last name, workID, yearStartedWked, and initSalary. It includes constructor(s) and properties to initialize values for all fields. Create an interface, SalaryCalculate, class that includes two functions: first,CalcYearWorked() function, it takes one parameter (currentyear) and calculates the number of year the worker has been working. The second function, CalcCurSalary() function that calculates the current year salary. Create a Worker classes that is derived from Employee and SalaryCalculate...
JAVA PROGRAMMING Part 1 Create a class Student, with attributes id, first name, last name. (All...
JAVA PROGRAMMING Part 1 Create a class Student, with attributes id, first name, last name. (All the attributes must be String) Create a constructor that accepts first name and last name to create a student object. Create appropriate getters and setters Create another class StudentOperationClient, that contains a main program. This is the place where the student objects are created and other activities are performed. In the main program, create student objects, with the following first and last names. Chris...
Create a program that allows a user to input customer records (ID number, first name, last...
Create a program that allows a user to input customer records (ID number, first name, last name, and balance owed) and save each record to a file. When you run the main program, be sure to enter multiple records. Once you create the file, open it and display the results to the user Save the file as  CustomerList.java
Create a table with name “S_YOURStudentID” with the following fields with required constraints. Screenshots are to...
Create a table with name “S_YOURStudentID” with the following fields with required constraints. Screenshots are to be attached.                                                                                               For example, if your botho student id is 1212121, your table name should be “S_1212121”.                                   Student id Student Name Age Gender City Course name Module Name Internal mark 1 Internal mark 2 Internal mark 3 Total internal mark Insert minimum 10 records/rows to the table. Input the data based on Question 5. Screenshots are to be attached.                                                                                                                              Create two users...
Consider the following relation AIRLINE TABLE Flight Date Flight ID Origin Destination Captain ID Captain Name...
Consider the following relation AIRLINE TABLE Flight Date Flight ID Origin Destination Captain ID Captain Name Number of Passengers on the Flight April 10 111 Chicago L.A. 111 Tracy 110 April 10 222 L.A. Phoenix 222 Matt 105 April 12 111 Chicago L.A. 444 Tim 98 April 12 333 L.A. N.Y. 111 Tracy 75 April 12 444 L.A. N.Y. 333 Pat 110 April 12 555 L.A. Dallas 444 Tim 111 April 12 222 L.A. Phoenix 555 Pat 107 Some of...
Using SQL create a new database called school_app. Create a student table with fields id (auto...
Using SQL create a new database called school_app. Create a student table with fields id (auto increment), first_name, last_name. Create a course table with fields id (auto increment), course code (such as ITC or MTH), and course number (such as 100 or 295). Note that the relationship between student and course is many-to-many (n:m). Create a join table called student_course that implements the n:m relationship with fields id (auto increment), student_id, course_id, and grade (which has values 0, 1, 2,...
Implement an Employee class that includes data fields to hold the Employee’s ID number, first name,...
Implement an Employee class that includes data fields to hold the Employee’s ID number, first name, last name, and hourly pay rate (use of string datatype is not allowed). Create an array of five Employee objects. Input the data in the employee array. Write a searchById() function, that ask the user to enter an employee id, if its present, your program should display the employee record, if it isn’t there, simply print the message ”Employee with this ID doesn’t exist”....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT