Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
4 views

Reviewer SQL

The document outlines the steps to create and manage a database named 'family' and a table named 'member' within it. It includes commands for creating, inserting, selecting, updating, and deleting records, as well as altering the table structure and dropping both the table and the database. The document serves as a guide for basic SQL operations related to database management.

Uploaded by

Althea Dato
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Reviewer SQL

The document outlines the steps to create and manage a database named 'family' and a table named 'member' within it. It includes commands for creating, inserting, selecting, updating, and deleting records, as well as altering the table structure and dropping both the table and the database. The document serves as a guide for basic SQL operations related to database management.

Uploaded by

Althea Dato
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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

You might also like