SQL DBMS

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 73

Database : School

Cardinality - 4 Cardinality - 5
Degree - 3 Degree - 3
Cardinality - 4 Cardinality - product
Degree - 3 Degree – sum

Cardinality - 5
Degree - 3
Find the cardinality and degree of student X games

Cardinality - 6
Degree - 4
MySQL supports three comment styles:

/* */ can span multiple lines


Art
CREATE DATABASE SCHOOL23;
USE school23;

CREATE TABLE student


(
rollno INTEGER(5) NOT NULL PRIMARY KEY,
name VARCHAR(20),
gender char(1),
marks INTEGER(3),
dob date
);

Describe student;

ALTER TABLE student ADD phone integer(8);

ALTER TABLE student MODIFY phone integer(10);

ALTER TABLE student CHANGE phone phoneno integer(8);

ALTER TABLE student drop phoneno ;


1. Which column could be a primary Key.
2. Write the SQL command to display ename, gender and gross from the table employee
3. Write the command to display gross greater than 50000
4. Display the 2 category of gender (avoid duplicate)
5. Display the ename to be employee name
6. Display ecode,ename,groass whose salary is between 30000 and 45000
7. Display the name of the employee who doe not belong in the ‘A1’ and ‘A2’ category
8. Display names whose name starts with ‘R’
9. Display names whose second last name is ‘m’
10.Display the details of the employee based on the descending order of the gross.
SELECT * FROM student S, fees F WHERE S.Rollno = F.Rollno;
SELECT * FROM student NATURAL JOIN fees ;

You might also like