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 Braveheart -- Eric McStrong -- Luke Gaylord -- Luke Frailton -- Suzie McFisterson -- Jonah Willington -- Isaac Willington -- Asher Flasher -- Write the statement here: insert into People(FirstName, LastName) values ('Eric', 'Braveheart') insert into People(FirstName, LastName) values ('Eric', 'McStrong') insert into People(FirstName, LastName) values ('Luke', 'Gaylord') insert into People(FirstName, LastName) values ('Luke', 'Frailton') insert into People(FirstName, LastName) values ('Suzie', 'McFisterson') insert into People(FirstName, LastName) values ('Jonah', 'Willington') insert into People(FirstName, LastName) values ('Isaac', 'Willington') insert into People(FirstName, LastName) values ('Asher', 'Flasher') -- ** 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 without using the "WHERE" keyword which returns results -- in the following format: -- FirstName Cnt -- Suzie 1 -- Jonah 1 -- Isaac 1 -- Asher 1 -- Write the statement here: select FirstName, count(FirstName) as Cnt from People group by FirstName having count(FirstName) = 1
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear