Can someone please help me with these Sql STATEMENTS all i need is the correct s
ID: 649375 • Letter: C
Question
Can someone please help me with these Sql STATEMENTS all i need is the correct statements
Create a database table called Recipes:
It should have the following fields:
RecipeID holds whole numbers, Should be the primary key.
RecipeName holds a string up to 20 characters
RecipeDesc holds a string value up to 2000 characters
RecipeDate holds a date/time. Default this to the system's datetime if none is entered during insert.
Create a primary key for the RecipeID column.
Create a sequence for the RecipeID column.
Write an insert statement that inserts a row of data into the Recipes table. You MUST use the sequence for
the RecipeID column field. Do not specify a value for the date field.
Write another insert statement that inserts a row of data into the Recipes table. You MUST use the sequence for
the RecipeID column field and you MUST specify a value for the date field.
Write a select statement that returns the RecipeID, RecipeName, and RecipeDate for all rows.
Create a private synonym called MyRecipes that refers to the Recipes table.
Create a public synonym called OurRecipes that refers to the Recipes table.
Write a select statement that returns the RecipeID, RecipeName, and RecipeDate for all rows in the MyRecipes synonym.
Write a select statement that returns the RecipeID, RecipeName, and RecipeDate for all rows in the OurRecipes synonym.
Write a statement to drop the MyRecipes synonym.
Write a statement to drop the OurRecipes synonym.
What you should submit to me:
#1 - sql to create table
#2 - sql to create primary key
#3 - sql to create sequence
#4 - sql to insert 1 row
#5 - sql to insert 1 row
#6 - sql for select statement
#7 - sql to create private synonym
#8 - sql to create public synonym
#9 - sql for select statement of private synonym
#10 - sql for select statement of public synonym
#11 - sql to drop private synonym
#12 - sql to drop public synonym
Explanation / Answer
CREATE DATABSE Food;
USE Food;
1,2,3. CREATE TABLE Recipies(RecipieID INT NOT AUTO INCREMENT), RecipeName VARCHAR(20), RecipeDesc VARCHAR(2000), RecipeDate DATE, PRIMARY KEY(RecipieID));
4. INSERT INTO Recipies(RecipieId,RecipieName,RecipieDesc, RecipieDate) VALUES(NULL, 'EGGS', Scrambles eggs', null);
5.INSERT INTO Recipies(RecipieId,RecipieName,RecipieDesc, RecipieDate) VALUES(NULL, 'coffee', coffee lattee', '2015-04-08');
6. SELECT RecipieId, RecipieName,RecipieDate FROM Recipies;
7. CREATE SYNONYM MyRecipies FOR Recipies;
8. CREATE PUBLIC SYNONYM OurRecipies FOR Recipies;
9. SELECT RecipieId, RecipieName,RecipieDate FROM MyRecipies;
10. SELECT RecipieId, RecipieName,RecipieDate FROM OurRecipies;
11. DROP SYNONYM MyRecipies;
12. DROP PUBLIC SYNONYM OurRecipies;