Provide the SQL statements to the following two queries in this order (you may enter one query after the other separated by a semi-colon and a new line). Create a table named "scholarship" with the fields school_id(primary key), student_id( referencing ID in students table) and amount (numeric value with precision of 8 and scale of 2). Use appropriate data types. Insert the scholarship amount of 40000 given to student "00128" with school_id "00001"
Question
Provide the SQL statements to the following two queries in this order (you may enter one query after the other separated by a semi-colon and a new line).
Create a table named "scholarship" with the fields school_id(primary key), student_id( referencing ID in students table) and amount (numeric value with precision of 8 and scale of 2). Use appropriate data types. Insert the scholarship amount of 40000 given to student "00128" with school_id "00001"
Solution
Sure, here are the SQL statements for your queries:
- Creating the table "scholarship":
CREATE TABLE scholarship (
school_id INT PRIMARY KEY,
student_id INT REFERENCES students(ID),
amount NUMERIC(8,2)
);
- Inserting the scholarship amount:
INSERT INTO scholarship (school_id, student_id, amount)
VALUES ('00001', '00128', 40000);
Similar Questions
Expected school_id student_id amount ---------- ---------- ---------- 00001 00128 40000 Got school_id student_id amount --------- ---------- ------ 00001 00128 40000
Give the database schema the following tables: Student (studentId, firstName, lastName, gender, birthday, phone, address, classId) Class (classId, className) Which code snippet will display records with the following 3 columns: classId, className and amount (amount of students)?SELECT c.classId, c.className, COUNT(*) AS amountFROM dbo.Class c INNER JOIN dbo.Student s ON c.classId = s.classId;SELECT c.classId, c.className, COUNT(*) AS amountFROM dbo.Class c INNER JOIN dbo.Student s WHERE c.classId = s.classIdGROUP BY c.classId, c.className;SELECT c.classId, c.className, COUNT(*) AS amountFROM dbo.Class c INNER JOIN dbo.Student s ON c.classId = s.classIdGROUP BY c.classId;SELECT c.classId, c.className, COUNT(*) AS amountFROM dbo.Class c INNER JOIN dbo.Student s ON c.classId = s.classIdGROUP BY c.classId, c.className;
Problem Statement: There are three tables: Student Table, Program Table, and Scholarship Table as shown belowWrite an SQL query to list STUDENT_ID who does not get Scholarship. Student Table STUDENT_ID FIRST_NAME LAST_NAME GPA ENROLLMENT_DATE MAJOR 201 Shivansh Mahajan 8.79 2021-09-01 09:30:00 Computer Science Program Table STUDENT_REF_ID PROGRAM_NAME PROGRAM_START_DATE 201 Computer Science 2021-09-01 00:00:00 Scholarship Table STUDENT_REF_ID SCHOLARSHIP_AMOUNT SCHOLARSHIP_DATE 201 5000 2021-10-15 00:00:00 AnswerLanguagejava1select s.student_id from student s left join PREVNEXT
Give the database schema the following tables:Student (studentId, firstName, lastName, gender, birthday, phone, address, classId)Class (classId, className)Which code snippet will list the id and names of class with more than 15 students?SELECT c.classId, c.className, COUNT(*) AS amountFROM dbo.Class c INNER JOIN dbo.Student s ON c.classId = s.classIdGROUP BY c.classId, c.classNameHAVING COUNT(*) > 15;SELECT c.classId, c.className, COUNT(*) AS amountFROM dbo.Class c INNER JOIN dbo.Student sWHERE c.classId = s.classId AND amount > 15GROUP BY c.classId, c.className;SELECT c.classId, c.className, COUNT(*) AS amountFROM dbo.Class c INNER JOIN dbo.Student s ON c.classId = s.classIdGROUP BY c.classId, c.classNameHAVING amount > 15;SELECT c.classId, c.className, COUNT(*) AS amountFROM dbo.Class c INNER JOIN dbo.Student s ON c.classId = s.classIdWHERE COUNT(*) > 15;
2.Question 2You are the database administrator for a school. Student information is kept in a students table where students are tracked by student_id. Students have a grade point average listed for each semester in a table named grades where each student is referenced by student_id.The school is giving an award to all students who achieved a 4.0 grade point average during any semester. You need to generate a list of all the students who should get the award. You begin typing your query:What should you type in the blank space? (Please type your answer all in lower case. Example: select)1 point
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.