Question

In: Computer Science

Assume the following relations are given, Student: <StudentiD, Name, Surname, Major, YearStarted> Write necessary queries for...

Assume the following relations are given,

Student: <StudentiD, Name, Surname, Major, YearStarted>

Write necessary queries for the followings:

1- Create the table and define necessary constraints (primary key, null constraint, etc.).

2- Insert at least 5 records into the table using Insert SQL.command.

3- Select all students having a major of Computer Engineering, print their name and student ID.

4- Update starting year of all Engineering students to 2015 (use like clause).

5- Delete all student with starting year less than 2010.

6- List all records and verify the results.

7- Drop the table.

Solutions

Expert Solution

1.

CREATE TABLE STUDENT (StudentID INT primary key , Name varchar(30) not null, Surname varchar(30) not null, Major varchar(30), Year INT);

2.

INSERT INTO Student VALUES(1,'Mayank','Bhardwaj','Computer Science',2018);

3.

SELECT Name,Surname,StudentID FROM Student WHERE Major = "Computer Engineering";

4.

UPDATE TABLE SET YEAR = 2015 WHERE Major like '%Engineering%';

5.

DELETE FROM Student WHERE Year < 2010;

6.

SELECT * FROM Student;

7.

DROP TABLE Student;


Related Solutions

Write a Java program for a restaurant with the following features: ◦ Customer: Name, Surname, ID...
Write a Java program for a restaurant with the following features: ◦ Customer: Name, Surname, ID (incremental ID by 1 for each new customer), Email, Phone, Address. ◦ Service: ID (incremental ID by1 for each group),CustomerID, Priority (High, Medium, Low, Other), ResolutionTimeFrame (Measured in Man hours), AssignedUser, Status(resolved or not), Fee. ◦ User (simple user of system): ID, Name, Surname, Username and Password (insert from code five fixed users), Address , PhoneNumber ◦ Manager: Name, Surname, Username and Password (insert...
) Write queries for the following. Include screenshots of the queries and the outputs. Create a...
) Write queries for the following. Include screenshots of the queries and the outputs. Create a procedure named DisplayInfo which takes customer name as a parameter and displays information of that customer. (database – sql_store)
Given the following relational schema, write queries in SQL to answer the English questions. There is...
Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid: integer, shipdate: Date/Time) ShippedProduct(sid:...
Given the following relational schema, write queries in SQL to answer the English questions. There is...
Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid: integer, shipdate: Date/Time) ShippedProduct(sid:...
Student Name and ID no. _________________________________________________________ Write the journal entries in the given table for below...
Student Name and ID no. _________________________________________________________ Write the journal entries in the given table for below transactions of Clean Corporation during June 2020. 1 Provided services to customers on account for $650. 2 Purchased a building using 10 year Note Payable for $200,000. 3 Paid salaries to employees, $2,600. 4 Received payment from customers to whom service was given in transaction 1 5 Paid $400 dividends to shareholders. Answer Accounts Debit Credit 1 2 3 4 5
Assume you are trying to choose 5 letters from your name and surname altogether (you can...
Assume you are trying to choose 5 letters from your name and surname altogether (you can use your name and surname. or can use someone's name and surname). By using the permutation rule, find how many different selection could be made if replacement is allowed and order is not important. By using the combination rule, find how many different selection could be made if replacement is allowed and order is not important. Repeat the same process once for the case...
Consider the following relations: Please answer in the form of symbol. Thank You Student (ssn, name,...
Consider the following relations: Please answer in the form of symbol. Thank You Student (ssn, name, address, major) Course(code, title) Registered(ssn,code) List the titles of all courses List the information of the students majoring in ‘CS’ List the codes of courses for which at least one student is registered (registered courses List the titles of registered courses List the codes of courses for which no student is registered
11) Enter the following using Java. Use for loop to enter student id, student name, major...
11) Enter the following using Java. Use for loop to enter student id, student name, major and grades. Also grades should display their letter grades based on their conditions. After that display the name of students and their info, and also their letter grade After that display the sum of all grades and the average Output Example: Student ID: 0957644 Student Name: Pedro Hernandez Student Major: Business Information Systems Grades for Fall 2020: Introduction to Computer Science using Java: 85,...
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName,...
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName, LastName, Year) Takes (Username, Department, Number, Term, Grade) [clarification] In Student, Year is an integer. A student can be a 2nd year student. In that case, Year value would be 2. For the Takes relation: ·         Grade is NA for current semester students ·         Username is foreign key to Student ·         (Department, Number, Term) is foreign key to Class a)       Write an SQL query that returns the Term...
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName,...
Write the following queries using the schema below Class (Number, Department, Term, Title) Student (Username, FirstName, LastName, Year) Takes (Username, Department, Number, Term, Grade) [clarification] In Student, Year is an integer. A student can be a 2nd year student. In that case, Year value would be 2. For the Takes relation: ·         Grade is NA for current semester students ·         Username is foreign key to Student ·         (Department, Number, Term) is foreign key to Class a)       Write an SQL query that returns the Term...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT