Write SQL statements for following:
Student( Enrno, name, courseId, emailId, cellno)
Course(courseId, course_nm, duration)
i) Add a column city in student table.
ii) Find out list of students who have enrolled in “computer” course.
iii) List name of all courses with their duration.
iv) List name of all students start with „a‟.
v) List email Id and cell no of all mechanical engineering students.
Answers
Answer:
SQL CREATE TABLE statement is used to create table in a database. If you want to create a table, you should name the table and define its column and each column's data type.
...
SQL CREATE TABLE
create table "tablename"
("column1" "data type",
"column2" "data type",
"column3" "data type",
...
Explanation:
mark as brainlest
Answer:
i.)alter table table_name add column_name date_type;
ii.)select * from Student where courseId=all(select courseId from Course where course_nm='computer');
iii.)select course_nm,duration from Course;
iv.)select name from Student where name like 'a%';
v.)select emailId,cellno from Student where courseId=all(select courseId from Course where course_nm='mechanical');
Explanation:
i.)add new column.
ii.)select courseId from Course where course_nm='computer';
this gives the courseId of the course_nm computer and then select * from Student where courseId= will get equal to the courseId occured from the courses and gives the list of students enrolled in it.
iii.)gives the course_nm and duration.
iv.)gives the names that start with the letter 'a'.
v.)select courseId from Course where course_nm='mechanical' gives the courseId of the mechanical branch and select emailId,cellno from Student where courseId= this get the value of courseId from the Course table which get match with the courseId in theStudent table and give their emailId and cell_no.