Write SQL statements for the following tasks using MySQL: 1. Create a database called lab2 2....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write SQL statements for the following tasks using MySQL: 1. Create a database called lab2 2. Create three tables as following in the database lab2 1. Students, three columns: first_name, last_name, student_id. The first two column should be text; the last one is an integer. Use student_id as the primary key. 2. Courses, two columns: course_title, course_id. They are both text. course_id should be the primary key. 3. Registration, three columns: student_id, a foreign key referencing student_id in the Students table; course_id, a foreign key referencing course_id in the Courses table; status, a text column that is meant to be 'registered', 'withdrawn', or 'pending permission', etc. You do not need to implement the constraint for the status column. The primary key should be the combination of the course_id and the student_id. 3. Add 5 students in the Students table. Choose any names as you like. 4. Add 2 courses in the Courses table. Choose any names as you like. 5. Register some students with both courses; some with each of the two course; and some with no course. 6. Find out the total number of students in each course. Be ready to do some other simple queries on this database. ER Diagram Student first name last name student id register status course course id course title Write SQL statements for the following tasks using MySQL: 1. Create a database called lab2 2. Create three tables as following in the database lab2 1. Students, three columns: first_name, last_name, student_id. The first two column should be text; the last one is an integer. Use student_id as the primary key. 2. Courses, two columns: course_title, course_id. They are both text. course_id should be the primary key. 3. Registration, three columns: student_id, a foreign key referencing student_id in the Students table; course_id, a foreign key referencing course_id in the Courses table; status, a text column that is meant to be 'registered', 'withdrawn', or 'pending permission', etc. You do not need to implement the constraint for the status column. The primary key should be the combination of the course_id and the student_id. 3. Add 5 students in the Students table. Choose any names as you like. 4. Add 2 courses in the Courses table. Choose any names as you like. 5. Register some students with both courses; some with each of the two course; and some with no course. 6. Find out the total number of students in each course. Be ready to do some other simple queries on this database. ER Diagram Student first name last name student id register status course course id course title
Expert Answer:
Answer rating: 100% (QA)
Certainly Here are the SQL statements for the tasks you mentioned 1 Create a database called lab2 sq... View the full answer
Related Book For
Posted Date:
Students also viewed these databases questions
-
A WiFi router transmits 800mW power from its antenna. How much this power in dBW and dBm? if a partition wall introduces 10dB power loss then how much power available to the other side of the wall
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
Case Study: Quick Fix Dental Practice Technology requirements Application must be built using Visual Studio 2019 or Visual Studio 2017, professional or enterprise. The community edition is not...
-
A beam of light enters the end of an optic fiber as shown in Fig. 23-52. Show that we can guarantee total internal reflection at the side surface of the material (at point a), if the index of...
-
Program and solve the differential equation of frictionless flow over a bump, for entrance conditions V0 = 1 m/s and y0 = 1 m. Let the bump have the convenient shape h = 0.5hmax [1 cos (2 x/L)],...
-
Repeat the calculations in Example 1 using a cubic runout spline to interpolate the five data points. Temperature ( C) Density (g/cm) 99815 99987 99973 99823 -10 10 20 30 99567
-
With reference to Example 2, Chapter 2, use the \(U\) statistic to test the null hypothesis of equality versus the alternative that the distribution of copper content from the first heat is...
-
For the equation (a) Find the transfer function and put it in standard gain/time constant form. (b) Discuss the qualitative form of the response of this system (independent of the input forcing) over...
-
Now that we have worked through our hypo, try doing one on your own. A sample format has been provided so that you can focus on your application. Mom and Dad were both at the mall, looking to...
-
During the Plan Order Phase, the hours for the Receive Order phase (marked with an *) are actual times, as this work has already been performed. In addition to these internal labors costs, the...
-
The trial balance of Lindor Limited as at 31 March 2023 was as follows: Administration expenses Distribution expenses Directors fees Bad debts Audit fees Trade receivables and trade payables...
-
Discuss the significance of adaptability in communication strategies, particularly in navigating diverse communication styles and preferences within multidisciplinary teams.
-
Nashville Blanket Co. buys and sells blankets. They employ the weighted average method. At the beginning of the year, Nashville Blanket Co. had 98 blankets which had been purchased at $30 per...
-
Q1. A uniform rod of length L and mass M is attached at one end to a frictionless pivot and is free to rotate about the pivot in the vertical plane, as shown in Figure. The rod is released from rest...
-
Each of the following independent companies is missing numerical data. Required: Use your knowledge of the financial statement equations and their interrelationships to fill in the missing amounts....
-
what ways can active listening techniques be refined to foster deeper empathy and understanding during interpersonal exchanges?
-
In the pelvic inlet, which is the shortest anteroposterior diameter? a) True conjugate b) Obstetric conjugate c) Anatomical conjugate d) Bispinous diameter
-
Reichenbach Co., organized in 2018, has set up a single account for all intangible assets. The following summary discloses the debit entries that have been recorded during 2018 and 2019. Instructions...
-
In this exercise, you modify the Password application from this chapters Apply lesson. Use Windows to make a copy of the Password Solution folder. Rename the copy Password Solution-Index. Open the...
-
When entered in the txtName_Enter procedure, which of the following will select all of the text boxs existing text? a. txtName.SelectAll() b. txtName.SelectAllText() c. SelectAll().txtName d. None of...
-
What is the result of the following expression: 96 \ 30? a. 3 b. 3.2 c. 6 d. None of the above.
-
Steam from an engine exhaust at 1.25 bar flows steadily through an electric calorimeter and comes out at \(1 \mathrm{bar}, 130^{\circ} \mathrm{C}\). The calorimeter has two \(\mathrm{kW}\) heaters...
-
The properties of water and steam become identical at (a) 0.1 bar (b) 1 bar (c) \(100 \mathrm{bar}\) (d) 212.2 bar.
-
In thermodynamic analysis, a pure substance is that which (a) Consists of only a single chemical species (b) has no dissolved impurities (c) may have a number of chemical species but the composition...
Study smarter with the SolutionInn App