0% found this document useful (0 votes)
108 views

MySQL Handout

This document creates a People database and Users table within it. It inserts, deletes, updates, and selects data from the Users table using various SQL statements to test functionality. It alters the Users table to add an auto-incrementing user ID column and non-unique name index.

Uploaded by

Senthil R
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views

MySQL Handout

This document creates a People database and Users table within it. It inserts, deletes, updates, and selects data from the Users table using various SQL statements to test functionality. It alters the Users table to add an auto-incrementing user ID column and non-unique name index.

Uploaded by

Senthil R
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

CREATEDATABASEPeople;

USEPeople;

CREATETABLEUsers(
nameVARCHAR(128),
emailVARCHAR(128)
)

DESCRIBEUsers;

INSERTINTOUsers(name,email)VALUES('Ted','[email protected]')

DELETEFROMUsersWHEREemail='[email protected]'

UPDATEUsersSETname=CharlesWHEREemail='[email protected]'

SELECT*FROMUsers

SELECT*FROMUsersWHEREemail='[email protected]'

SELECT*FROMUsersORDERBYemail

SELECT*FROMUsersWHEREnameLIKE'%e%'

SELECT*FROMUsersORDERBYemailDESCLIMIT2;

SELECT*FROMUsersORDERBYemailLIMIT1,2;

CREATETABLEUsers(
user_idINTUNSIGNEDNOTNULLAUTO_INCREMENTKEY,
nameVARCHAR(128),
emailVARCHAR(128),
INDEX(name)
);

ALTERTABLEUsersADDINDEX(name)

You might also like