PDA

View Full Version : Any MySQL gurus out there?



finboy
02-09-2016, 05:21 PM
Long story short, I'm trying to get into sait, they made me take a coursera prerequisite on intro to SQL. Needless to say the online support and overall instruction is NOT great.

I have written up the code for an assignment, but NO instructions have been given on how to lead it into MySQL, nor has any direction been given on modifying syntax to counter restrictions of using MySQL over oracle.

I'm kind of at the endo of my rope here, can anyone help me out?

mazdavirgin
02-09-2016, 06:27 PM
SQL should be fairly standard across the board until you get into some of the weirder DB implementation specific stuff. As for how to query against the DB well that depends. You can technically just open the MySQL DB with a viewer and run commands against that data. Probably easier than trying to figure out sockets and whatnot to do it via the network. :dunno:

finboy
02-09-2016, 06:36 PM
I'm using the MySQL workbench per the program requirements, and have to build the database off of scripts written per the requirement of the program. Unfortunately, every youtube example or tutorial I can find doesn't really build off of scripts, rather clicking through and populating tables with graphical interface. I've got a migrane after today :banghead:

Essentially I have to build 8 tables using script, set the rules of those tables, then populate them with rewritten script. In concept I get it, but figuring out how to make it all work in MySQL without direction is a nightmare

rage2
02-09-2016, 07:24 PM
1. Create database in workbench with needed permissions
2. Populate data in UI
3. Create database backup as sql script.
4. ???
5. Profit.

The sql script backup creates a sql script that will basically rebuild the database, including all data, using sql statements. You can backup in workbench or command line.

https://dev.mysql.com/doc/refman/5.0/en/mysqldump-sql-format.html

Make sure you sanitize the script a bit so it looks like you wrote it and not mysqldump haha.

mazdavirgin
02-09-2016, 08:18 PM
Originally posted by finboy
I'm using the MySQL workbench per the program requirements, and have to build the database off of scripts written per the requirement of the program. Unfortunately, every youtube example or tutorial I can find doesn't really build off of scripts, rather clicking through and populating tables with graphical interface. I've got a migrane after today :banghead:

Essentially I have to build 8 tables using script, set the rules of those tables, then populate them with rewritten script. In concept I get it, but figuring out how to make it all work in MySQL without direction is a nightmare

http://www.w3schools.com/sql/sql_create_table.asp

http://www.w3schools.com/sql/sql_primarykey.asp

http://www.w3schools.com/sql/sql_insert.asp

:dunno:

I'm really not too sure where the confusion lies in this unless you really have no clue whats going on?

finboy
02-09-2016, 08:34 PM
Originally posted by mazdavirgin


http://www.w3schools.com/sql/sql_create_table.asp

http://www.w3schools.com/sql/sql_primarykey.asp

http://www.w3schools.com/sql/sql_insert.asp

:dunno:

I'm really not too sure where the confusion lies in this unless you really have no clue whats going on?

That all makes sense, I my coding matches similar to what is there, I just have no idea where in MySQL I have to enter it in the workbench. I will get some screenshots tomorrow to help explain the issue.

EDIT:

okay here we go...

here is the model of the database we have to build...

http://i1365.photobucket.com/albums/r742/adamfindlay84/Database%20Model_zpszxaetzw6.jpg

here is an example of the mysql formatted script that will build one of the tables, and the insert functions that need to be added once the table is built...

http://i1365.photobucket.com/albums/r742/adamfindlay84/Script_zpsmb149man.jpg

here is workbench at home screen...

http://i1365.photobucket.com/albums/r742/adamfindlay84/Workbench_zpsrnbd2kar.jpg

I tried script in the query box without luck, note i would have to remove the insert lines, this was just a quick copy and paste for a photo...

http://i1365.photobucket.com/albums/r742/adamfindlay84/Query_zpsi7bknqqk.jpg

there is the option of selecting "build new table"...

http://i1365.photobucket.com/albums/r742/adamfindlay84/Tables_zpsqutwd1z1.jpg

But it opens a new window that only allows filling in content individually, no scripts.

http://i1365.photobucket.com/albums/r742/adamfindlay84/New%20Table_zpsgfzqsf3x.jpg

my class mate posted this screen cap, it looks like he managed to get the content in as required, but feedback from the discussion board on the corsera site is slow to say the least...

http://i1365.photobucket.com/albums/r742/adamfindlay84/Classmate_zps1gaxi8h4.jpg

something tells me it is a stupidly easy thing to do, and i will end up looking like an idiot for not finding it, but my brain is not working all that well today.

mazdavirgin
02-09-2016, 09:39 PM
https://dev.mysql.com/doc/workbench/en/wb-sql-editor-toolbar.html

:dunno:

finboy
02-10-2016, 12:28 PM
managed to start building tables, now working on syntax errors, thanks for the help guys

CompletelyNumb
02-10-2016, 12:54 PM
Originally posted by rage2
1. Create database in workbench with needed permissions
2. Populate data in UI
3. Create database backup as sql script.
4. ???
5. Profit.

The sql script backup creates a sql script that will basically rebuild the database, including all data, using sql statements. You can backup in workbench or command line.

https://dev.mysql.com/doc/refman/5.0/en/mysqldump-sql-format.html

Make sure you sanitize the script a bit so it looks like you wrote it and not mysqldump haha.


:werd:

Coursera as a sait prerequisite. Nice.