Due Date: 10/21/24
This program creates a database to store information about individuals.
CREATE DATABASE customer;
This creates the database with the name customer
.
USE customer;
This command switches the context to the customer
database for data manipulation.
CREATE TABLE customerData (
id INT PRIMARY KEY AUTO_INCREMENT,
First_Name VARCHAR(20),
Last_Name VARCHAR(20),
Address_ VARCHAR(20),
City VARCHAR(20),
State_ VARCHAR(2),
Zip_code VARCHAR(5),
Birth_Date DATE,
phone VARCHAR(20)
);
This creates a table named customerData
with specified fields.
CREATE INDEX idx_Last_Name ON customerData(Last_Name);
CREATE INDEX idx_State_ ON customerData(State_);
These commands create indexes to improve search efficiency on Last_Name
and State_
.
DESCRIBE customerData;
This command displays the structure of the customerData
table.
INSERT INTO customerData (First_Name, Last_Name, Address_, City, State_, Zip_code, Birth_Date, phone)
VALUES
("Stephen","Angelella","2788 Marion St","Bellmore","NY","11710","1970-12-04","(719) 547-4746"),
("Allen","Attaway","PO Box 643","Piscataway","NJ","08855","1990-12-04","(848) 800-7645"),
("Baron","Ballester","186 Lexington Avenue","Westwood","NJ","07675","1970-11-05","(778) 985-6673"),
("George","Bartels","77 Allen Road","Rockville Centre","NY","11570","1970-11-04","(640) 713-1323"),
("Michael","Bartolome","228 South 17th Avenue","Manville","NJ","08835","1930-01-04","(464) 521-0712"),
("Hugh","Bentley","7 Holly Tree Lane","East Islip","NY","11730","2010-01-02","(911) 661-2928"),
("Robert","Bielsky","931 Peninsula Blvd","Woodmere","NY","11598","2008-02-06","(684) 215-3002"),
("George","Botsch","511 Rockaway Street","West Islip","NY","11795","2009-12-07","(914) 924-6320"),
("Duane","Burrell","22 Van Buskirk Rd","Teaneck","NJ","07666","1970-06-04","(870) 640-2874"),
("Michael","Caldarella","108 Kemah-Mecca Lake Road","Newton","NJ","07860","1970-05-04","(792) 481-4668"),
("Pephen","Belella","120 S. Rigewood Place","Chester","PA","19013","1954-01-04","(223) 285-3419"),
("Lephen","Selella","210 W. Rideod Lane","Hightstown","NJ","08520","1921-01-04","(280) 919-5145"),
("Stepeyn","Langelella","230 N. Ridgewood Court","Hightstown","NJ","19013","1970-02-02","(687) 560-7921"),
("Jetephen","Angel","920 E. Tidgewood Lane","Hightstown","NJ","08520","1960-12-08","(701) 534-6850"),
("Stephn","Lella","990 N. Widgewood Place","Chester","PA","19013","1970-12-12","(797) 797-0607"),
("Steehen","Asela","210 S. Nidgewood Ave","Hightstown","NJ","08520","2012-12-03","(497) 794-0607"),
("pepen","Anlla","820 W. Cidgewood Center","Chester","PA","19013","2012-03-21","(397) 794-0647"),
("Stephen","Gelea","229 N. Pidgewood Ave","Hightstown","NJ","08520","2010-01-22","(397) 194-0507"),
("Stehen","Zelella","120 S. Slidgewood Place","Chester","PA","19013","1960-01-03","(392) 794-0602"),
("Sephen","Telella","229 E. Ligewood Lane ","Hightstown","NJ","08520","2020-11-06","(397) 794-2607");
This command inserts multiple values into the customerData
table.
SELECT * FROM customerData;
This retrieves all the data from the customerData
table and displays it.
DROP DATABASE customer;
This command deletes the customer
database from the server.