SQLTeam.com | Weblogs | Forums

DML-Writing Inset statements


#1

How would i write appropriate INSERT statements to add the following two recipes into the database. Save the script as recipes.sql.

Kitchen Sink Cookies
Submitted By: Cara
Reference: allrecipes.com (http://allrecipes.com/Recipe/Kitchen-Sink-Cookies/Detail.aspx)

INGREDIENTS
• 1 cup butter, softened
• 2 cups packed brown sugar
• 2 eggs
• 2 teaspoons vanilla extract
• 2 1/3 cups all-purpose flour
• 1 teaspoon baking soda
• 1 teaspoon salt
• 2 cups rolled oats
• 1 cup semisweet chocolate chips
• 1 cup vanilla baking chips
• 1/2 cup butterscotch chips
• 1 cup chopped pecans

DIRECTIONS

  1. Preheat the oven to 375 degrees F (190 degrees C).
  2. In a large bowl, cream together the butter and brown sugar until smooth. Beat in the eggs one at a time, then stir in the vanilla. Combine the flour, baking soda and salt; stir into the creamed mixture. Mix in the oats, chocolate chips, vanilla chips, butterscotch chips and chopped pecans. Drop by tablespoonfuls onto ungreased cookie sheets. Cookies should be at least 2 inches apart.
  3. Bake for 8 to 10 minutes in the preheated oven. Allow cookies to cool on baking sheet for 5 minutes before removing to a wire rack to cool completely.

No Bake Cookies II
Submitted By: Sandy
Reference: allrecipes.com (http://allrecipes.com/Recipe/No-Bake-Cookies-II/Detail.aspx)

INGREDIENTS
• 2 cups white sugar
• 1/2 cup butter
• 1/2 cup milk
• 3 tablespoons cocoa powder
• 3 cups quick cooking oats
• 1 teaspoon vanilla extract

DIRECTIONS

  1. Mix together sugar, butter or margarine, and milk in a saucepan. Bring to a boil and boil for one minute, stirring constantly.
  2. Remove from heat and mix in cocoa, quick oatmeal and vanilla. Drop by spoonfuls on waxed pape

#2

The easiest way:
create table recipe ( recipe_name varchar(100), recipe varchar(MAX))
go
insert into recipe values ('Kitchen Sink Cookies',
'Kitchen Sink Cookies
Submitted By: Cara
Reference: allrecipes.com (http://allrecipes.com/Recipe/Kitchen-Sink-Cookies/Detail.aspx)

INGREDIENTS
• 1 cup butter, softened
• 2 cups packed brown sugar
• 2 eggs
• 2 teaspoons vanilla extract
• 2 1/3 cups all-purpose flour
• 1 teaspoon baking soda
• 1 teaspoon salt
• 2 cups rolled oats
• 1 cup semisweet chocolate chips
• 1 cup vanilla baking chips
• 1/2 cup butterscotch chips
• 1 cup chopped pecans

DIRECTIONS

  1. Preheat the oven to 375 degrees F (190 degrees C).
  2. In a large bowl, cream together the butter and brown sugar until smooth. Beat in the eggs one at a time, then stir in the vanilla. Combine the flour, baking soda and salt; stir into the creamed mixture. Mix in the oats, chocolate chips, vanilla chips, butterscotch chips and chopped pecans. Drop by tablespoonfuls onto ungreased cookie sheets. Cookies should be at least 2 inches apart.
  3. Bake for 8 to 10 minutes in the preheated oven. Allow cookies to cool on baking sheet for 5 minutes before removing to a wire rack to cool completely.')
    go
    insert into recipe values ('No Bake Cookies II ',
    'No Bake Cookies II
    Submitted By: Sandy
    Reference: allrecipes.com (http://allrecipes.com/Recipe/No-Bake-Cookies-II/Detail.aspx)

INGREDIENTS
• 2 cups white sugar
• 1/2 cup butter
• 1/2 cup milk
• 3 tablespoons cocoa powder
• 3 cups quick cooking oats
• 1 teaspoon vanilla extract

DIRECTIONS

  1. Mix together sugar, butter or margarine, and milk in a saucepan. Bring to a boil and boil for one minute, stirring constantly.
  2. Remove from heat and mix in cocoa, quick oatmeal and vanilla. Drop by spoonfuls on waxed pape')

#3

So what schema do you have so far?


#4

I'm not sure what schema you talking about. I am confused on how to put the ingredients and directions in one. Like for the first one is it like this:

create table recipe ( recipe_name varchar(100), recipe varchar(MAX))
go
insert into recipe values ('Kitchen Sink Cookies',
'Kitchen Sink Cookies
Submitted By: Cara
Reference: allrecipes.com (http://allrecipes.com/Recipe/Kitchen-Sink-Cookies/Detail.aspx)

INGREDIENTS
1 cup butter, softened
2 cups packed brown sugar
2 eggs
2 teaspoons vanilla extract
2 1/3 cups all-purpose flour
1 teaspoon baking soda
1 teaspoon salt
2 cups rolled oats
1 cup semisweet chocolate chips
1 cup vanilla baking chips
1/2 cup butterscotch chips

DIRECTIONS

  1. Preheat the oven to 375 degrees F (190 degrees C).
  2. In a large bowl, cream together the butter and brown sugar until smooth. Beat in the eggs one at a time, then stir in the vanilla. Combine the flour, baking soda and salt; stir into the creamed mixture. Mix in the oats, chocolate chips, vanilla chips, butterscotch chips and chopped pecans. Drop by tablespoonfuls onto ungreased cookie sheets. Cookies should be at least 2 inches apart.
  3. Bake for 8 to 10 minutes in the preheated oven. Allow cookies to cool on baking sheet for 5 minutes before removing to a wire rack to cool completely.');