#login to server (Confirm the IP in the labs)
Go to Run(WINDOWS) or open Terminal (MAC/LINUX)
ssh student@10.20.47.68
password: student
//remember the password will be invisible, so type and press enter
#login to mysql
mysql -u student -p
password: student
//remember the password will be invisible, so type and press enter
#create database
create database <registration no.>
use <registration no.>
#create table
CREATE TABLE Persons
(
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);
#check table and its attribute/columns names
desc Persons;
#Insert data into table
INSERT INTO Persons(PersonID,LastName,FirstName,Address,City) VALUES(1011,’Mehta’,’Kunal’,’myaddress’,’Haridwar’);
---enter 10 records minimum
#Querying data
Query1: Show up all the records
Select * from Persons;
Query2: Show up the only first name and last name of all the students
Select FirstName, LastName from the Persons;
Query3: Show up the only first name and last name of all the students
Select FirstName, LastName from the Persons;
Query4: Show all the names of the different cities student/person belongs to
Select DISTINCT city from Persons;
Query5: Show up the all the record of the students who belongs to Delhi.
Select * from student where city=’Delhi’;