Sql Learning

 avatar
Atomic
sql
2 years ago
589 B
3
Indexable
--create database 
CREATE DATABASE temp;

--use database
USE temp;

-- creating table named as classroom
CREATE TABLE classroom
(
  "ID" int8 PRIMARY KEY,
  "Name" varchar(50) NOT NULL,
  "City" char(50),
  "Class" int
);

--Enter the data of the sstudnet in the table classroom
INSERT INTO classroom
(ID,Name,City,Class)
values
(1,'Aman','Delhi',7),
(2,'Ankit','Ghaziabad',8),
(3,'Riya','Vasundhara',7),
(4,'Himanshu','Varanasi',9);

--how to see table content 
SELECT * FROM classroom


--change the data in the table 
UPDATE classroom set Name = "Rishabh", City = "Raipur" where ID = 4;