SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
CREATE TABLE People ( Id int NOT NULL IDENTITY, FirstName varchar(100) NOT NULL, LastName varchar(100) NOT NULL ) -- ** Problem 1: -- Add a column, FavoriteColor (optional, not required, varchar(100)), to the previous table. -- Write the statement here: alter table people add FavoriteColor varchar(100) -- ** Problem 2: -- Insert the following names into the People table: -- Eric Dainty -- Eric Frolicker -- Eric Dancer -- Luke Powers -- Luke Masters -- Shirley Hoover -- Max Eagerson -- Write the statement here: insert into people(FirstName,LastName) values('Eric' ,'Dainty'),('Eric' ,'Frolicker'),('Eric','Dancer' ),('Luke','Powers' ), ('Luke', 'Masters'),('Shirley', 'Hoover'),('Max', 'Eagerson') -- ** Problem 3: -- Update all records in the People table so that FavoriteColor is 'Orange' -- Write the statement here: update people set FavoriteColor='orange' -- ** Problem 4: -- Write a query that finds all records where the last name ends with the letter "n". -- Write the statement here: select * from people where LastName like'%n' -- ** Problem 5: -- Write a query to provide a list of all the FirstName values that are in the table, -- along with how many times they names are in there: -- Example results: -- FirstName Num -- Eric 3 -- Luke 2 -- Shirley 1 -- Max 1 -- Write the statement here: select FirstName,count(*) as Num from people group by FirstName having FirstName -- ** Problem 6: -- Modify the query for problem five to only show FirstName values that are in the table once. -- Example results: -- FirstName Num -- Shirley 1 -- Max 1 -- Write the statement here:
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear