DB Designers: \g

1 view
Skip to first unread message

Scott

unread,
Mar 28, 2011, 3:04:13 AM3/28/11
to cis605
To anyone writing the sql scripts...

I think we covered this in class, but it doesn't seem like mysql
workbench likes the \g command. From what I can tell it is a
formatting tool that is useful in mysql client, but I didn't know if
there was a substitute we should use if writing the scripts in
workbench.

Also...

In the create database script, did you use just a CREATE DATABASE xxx,
or also add the DEFAULT latin1, etc that the mysqldump files give?

Sabin, Mihaela

unread,
Mar 28, 2011, 8:40:08 AM3/28/11
to cis...@googlegroups.com
Good questions, Scott!

If you use MySQL workbench, then leave out \G (which is different than \g). You're right, it's only for formatting the output when run in mysql command line interface utility. I do prefer to use mysql and write the script in Notepad++. It's quicker for me: the script is saved in a file and I can do more 'poking' of the database with quick SQL commands at mysql prompt.

Do not add anything from what mysqldump creates and it's not shown in the SQL scripts examples in the class notes.

Chris Reekie

unread,
Mar 28, 2011, 10:27:27 AM3/28/11
to cis...@googlegroups.com
I think I ran into something similar with workbench my insert into file has
SELECT * FROM xxx after every set of data.
Workbench just stops when it gets to the "select * from".
--
Thanks, Chris

Sabin, Mihaela

unread,
Mar 28, 2011, 1:40:25 PM3/28/11
to cis...@googlegroups.com

Chris, does adding ; after “select * from xxx” help? In other words, when the script is run, the insertion takes place, some message is displayed about the number of rows that were changed, and then the content of the table is displayed?

Chris Reekie

unread,
Mar 28, 2011, 4:41:46 PM3/28/11
to cis...@googlegroups.com
Not in Workbench, it will install the data/table ect.. run the select * then stop.
Id have to recreate the file to be sure, but it was only for testing so I just deleted all the select *'s and it will run in workbench.
--
Thanks, Chris

Sabin, Mihaela

unread,
Mar 28, 2011, 7:10:54 PM3/28/11
to cis...@googlegroups.com

I recommend we simply comment it out. When we run the script with ‘source’ command in mysql, we can then uncomment ‘select * …’.

 

It’s strange that the xxx_insert_data.sql with ‘select *…’ statements in it won’t work in the Workbench. I’m probably missing something…

Reply all
Reply to author
Forward
0 new messages