sql exp2


--1. write command TO CREATE student TABLE.
create TABLE student(
    rollno int,
    NAME varchar(20),
    class varchar(10),
    address varchar(20),
    PRIMARY KEY(rollno)
);

--2. write commands TOINSERT records INTO   student TABLE. →insert
INTO student
VALUES
    (
        1356,
        'Tejas',
        'FYTPE',
        'Jaysingpur'
    );

INSERT INTO
    student
VALUES
    (
        2332,
        ‘ narendra ’,
        ‘ sytpe ’,
        ‘ kolhapur ’
    );

INSERT INTO
    student
VALUES
    (
        3524,
        ‘ milind ’,
        ‘ finalft ’,
        ‘ ichalkaranji ’
    );

INSERT INTO
    student
VALUES
    (
        4427,
        ‘ virat ’,
        ‘ finaltc ’,
        ‘ ichalkranji ’
    );

INSERT INTO
    student
VALUES
    (
        2134,
        ‘ rahul ’,
        ’ sytt ’,
        ‘ sangli ’
    );

INSERT INTO
    student
VALUES
    (
        3242,
        ‘ amol ’,
        ‘ tymmtt ’,
        ‘ kolhapur ’
    );

INSERT INTO
    student
VALUES
    (
        4234,
        ‘ manish ’,
        ‘ finalmmtt ’,
        ‘ sangli ’
    );

3.write command TO CREATE student_marks TABLE.→ create TABLE student_marks(
    rollno int,
    sub1 int,
    sub2 int,
    sub3 int,
    sub4 int,
    sub5 int,
    PRIMARY KEY(rollno)
);

4.write commands TOINSERT records INTO student_marks TABLE.→
INSERT INTO
    student_marks
VALUES
    (
        1356,
        42,
        45,
        48,
        50,
        35
    );

INSERT INTO
    student_marks
VALUES
    (
        2332,
        49,
        56,
        42,
        50,
        57
    );

INSERT INTO
    student_marks
VALUES
    (
        3524,
        48,
        53,
        44,
        55,
        60
    );

INSERT INTO
    student_marks
VALUES
    (
        4427,
        65,
        62,
        55,
        57,
        60
    );

INSERT INTO
    student_marks
VALUES
    (
        2134,
        38,
        47,
        52,
        59,
        45
    );

INSERT INTO
    student_marks
VALUES
    (
        3242,
        55,
        52,
        48,
        60,
        61
    );

INSERT INTO
    student_marks
VALUES
    (
        4234,
        47,
        53,
        51,
        49,
        30
    );

--5.write command TOUPDATE address TO jaysingpur OF roll number 2134.→
update
    student
SET
    address = 'Jaysingpur'
WHERE
    rollno = 2134;

--6.write command TO increase marks OF ALL students IN subject1 BY 5.→
update
    student_marksSET sub1 = sub1 + 5;

--7.write command TODELETE records OF final year students.→ delete *
FROM
    student
WHERE
    class = 'FinalTT'
    OR class = 'FinalMMTT'
    OR class = 'FinalTPE'
    OR class = 'FinalTC'
    OR class = 'FinalFT';

Post a Comment

0 Comments