SQL

1. The CREATE TABLE statement is used to create a new table in a database.

CREATE TABLE Students
(
    ID int,
    Name varchar(255),
    Address varchar(255),
    Cell Number(11) 
);
Students
ID
Name
Address
Cell





2.The INSERT INTO statement is used to insert new records in a table.

INSERT INTO Students (ID, Name, Address, Cell)
VALUES (101, 'Erich', 'London', '01234');
VALUES (102, 'Stephen', 'Newyork', '01234');
VALUES (103, 'Azad', 'London', '01234');
VALUES (104, 'Emdad', 'Dhaka', '01234');

Students
ID
Name
Address
Cell
101
Erich
London
01234
102
Stephen
Newyork
01234
103
Azad
London
01234
104
Emdad
Dhaka
01234

3. The following SQL adds an "Email" column to the "Students" table:

ALTER TABLE Students
ADD Email varchar(255);
Students
ID
Name
Address
Cell
Email
101
Erich
London
01234

102
Stephen
Newyork
01234
103
Azad
London
01234
104
Emdad
Dhaka
01234


4. The following SQL deletes the "Email" column from the "Students" table:

ALTER TABLE Students
DROP COLUMN Email;

Students
ID
Name
Address
101
Erich
London
102
Stephen
Newyork
103
Azad
London
104
Emdad
Dhaka

         5. ডেটাবেজ থেকে তথ্য সিলেক্ট/পুনরূদ্ধার করতে SQL ‘SELECT’ স্টেটমেন্টটি ব্যবহার করা হয়।

       SELECT name_of_column, name_of_column FROM name_of_table;
       যেমন:   SELECT Name, Address FROM Students;

No comments:

Post a Comment