CREATE DATABASE family; family is the database name
SHOW DATABASES;
USE family; to be able to create a table in family database
CREATE TABLE member ( id int primary key auto_increment, name varchar (50)
not null, price float not null); member is the table name
DESC member; to see the structure of the table
INSERT INTO member ( id, name, price ) VALUES ( 1, ‘robert’ , 6.7);
SELECT *FROM member ; to see the records/ table
ID Name Price
1 Robert 6.7
to add another rows
INSERT INTO member ( id, name, price ) VALUES ( 2, ‘ anna’, 7.9);
SELECT *FROM member ;
ID Name Price
1 Robert 6.7
2 Anna 7.9
DELETE FROM member WHERE id = 2; to delete a row/ record
SELECT *FROM member ;
ID Name Price
1 Robert 6.7
ALTER TABLE ADD COLUMN last varchar (20) not null; to add a column
SELECT *FROM member ;
ID Name Price last
1 John 6.7
UPDATE member SET last = ‘John’ WHERE id =1 ;
SELECT *FROM member ;
ID Name Price last
1 John 6.7 John
ALTER TABLE member DROP COLUMN last;
SELECT *FROM member ;
ID Name Price
1 John 6.7
DROP TABLE member; to delete the table member
SHOW TABLES; it should be empty set
DROP DATABASE family; to delete the database family