Q1. CSUEB is a university. Its database includes a Student Table and a Student M
ID: 3729263 • Letter: Q
Question
Q1. CSUEB is a university. Its database includes a Student Table and a Student Major table. Each Student can declare at most two majors. Describe how this rule can be enforced in a Include in your description the type of SQL statement to be used, the tables involved, and whether the rule is checked before inserting records into a table or after they are inserted. n enterprise database. Student Table StudentMajor Table StudentNo StudentName StudentNo MajoriD Alice Bob Q2: A furniture store needs a database solution to support its sales process. The information to be stored includes sales transactions as items are purchased, and customer information so the customer can be appropriately billed and the product delivered. Several sales transactions take place in a day and data about each transaction (typically price and information about 1 or 2 furniture items purchased) need to be recorded. Sometimes data about a specific purchased would need to be retrieved to provide customer service. What kind of a database solution is relevant in this case? An operational database or an analytical one such as a data warehouse? Provide 3 reasons in support of your recommendation.Explanation / Answer
Solution:
We need to define a foreign key attribute in the StudentMajor table which will define the relationship of one to many
So while defining the tables in the database we need to follow this query given below:
CREATE TABLE Student(
StudentNo int NOT NULL,
StudentName;
PRIMARY KEY (StudentName)
);
CREATE TABLE StudentMajor(
StudentNo int NOT NULL,
MajorID int NOT NULL,
PersonID int,
PRIMARY KEY (MajorID),
CONSTRAINT FK_StudentID FOREIGN KEY (StudentID)
REFERENCES Student(StudentID)
);
2)
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.