• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Creating a recipe database (Step 1: Creating a database via MySQL)

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I started off on the wrong foot here when explaining myself on what I was trying to do, here. So, I'll try again from the ground up...

I've been trying to Create a database script that includes the SQL code for the following steps, aiming to execute each step using MYSQL Workbench to create and populate a new table called "recipe" in a database I already created called "fooddb". Said table was needed to have columns for "id" using auto incrementation, a title name for the recipe, One string of Instructions, an int for numOfServings, and an int for totalTime, in minutes.

So far, this is what I have created, using MySQL and documenting my progress... I have already created the database, fooddb, however, but I'll include that in my code I'm presenting here as well...


(I will use "insert into recipe values" for inserting many different elements, preferably 10 of them.)
My real concern is if any of this is right so far... Thank you for any advice offered here, otherwise.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question: why are you trying to create the tables in code? Usually the tables are created outside of the code -- the code just expects the tables to already be there.
 
Shakur Burton
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Question: why are you trying to create the tables in code? Usually the tables are created outside of the code -- the code just expects the tables to already be there.



I'm trying to get the tables recognized by the code I have created in Java, once this MySQL code has successfully compiled.
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what's the problem? You can easily use database tools (I use DbVisualizer -- there are plenty to choose from) to make sure that the table haste been created correctly -- or event to create the tables.

Once created, referencing them from Java is just a matter of the proper JDBC code (or ORM if you are using one).
 
Shakur Burton
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've already created and successfully compiled this MySQL code in the MySQL database. But yeah, all that matters now is making sure it works alongside the Java code I posted in my second step to approaching this process. Very good advice, though. Thanks for that.
 
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic