SQL Question...

Discuss anything related to audio or music production.
loydb
Posts: 178
Joined: Wed Jan 06, 2010 9:28 pm

Re: SQL Question...

Post by loydb » Tue Dec 18, 2012 8:57 pm

Oh Cygwin, how I hate thee. :) I was really happy when the whole "VM" thing took off, so I could easily have a proper Linux box in my Windows environment.

Just to finish up a thought for the OP:

Using mysqldump is a fantastic way to learn a lot about how to correctly model a database. If you're working on a tutorial with a sample database, it can be very educational to see exactly how the tables are constructed.

From the command line, the first example dumps out your entire MySQL database -- all db/table/index creation SQL, and INSERT statements for all of the data (a quick way to learn how to properly construct an INSERT statement for a particular table). If you just want a single database, use the second variant. The third line will recreate the database(s) from your file on another system. It's also a good quick n' dirty way to backup your database periodically.

mysqldump -uroot -p --all-databases > outputfile.sql
or
mysqldump -uroot -p --databases <dbname> > outputfile.sql


mysql -uroot -p < outputfile.sql
MFOS Ultimate Expand-o-tron Build Log: http://www.electro-music.com/forum/view ... 797#308797
MFOS Mini-Controller Build Log [FINISHED!]: http://www.electro-music.com/forum/view ... hp?t=42968

H20nly
Posts: 16067
Joined: Sat Oct 27, 2007 9:15 pm
Location: The Wild West

Re: SQL Question...

Post by H20nly » Tue Dec 18, 2012 9:11 pm

Cygwin :x i've had other... issues... with that shell of despair.



thanks for added info Angstrom.
loydb - you're awesome! i can't thank you enough for the points of reference and instructions.

i was having my doubts about the info i was going to get from starting this thread. i am pleased at how helpful you have all been. i am most grateful to you all for taking the time... if any of you are every near Berkeley or Oakland... make sure to send a PM. the first drink is definitely on me. :D

DIgiDennis
Posts: 142
Joined: Thu Jul 13, 2006 7:07 am
Location: DK - 1659

Re: SQL Question...

Post by DIgiDennis » Tue Dec 18, 2012 9:58 pm

One of the better tools for mysql, when you get more into it, is this: workbench
Good visual editor, reverse Engineering, etc. Etc.

Especialy handy if you work with a framework that doesnt generate the schema for you

ian_halsall
Posts: 1715
Joined: Fri May 27, 2011 8:52 am
Location: South London
Contact:

Re: SQL Question...

Post by ian_halsall » Wed Dec 19, 2012 1:11 pm

trouble is with mysql is that not many people use it in industrial strength applications and it doesn't support a lot of the features that sql server and Oracle have.

Since both Oracle and Sql server have express editions which are free for non-commercial use why bother with mysql unless you are going to build a project from it?

ian_halsall
Posts: 1715
Joined: Fri May 27, 2011 8:52 am
Location: South London
Contact:

Re: SQL Question...

Post by ian_halsall » Wed Dec 19, 2012 1:13 pm

yeah Cygwin sucks - I prefer to use the dos window

why could Microsoft never make a decent shell?

UNIX has about 50 - even Bourne shell is better than command prompt

BASH is my fave - going all misty eyed thinking about it - so long since I used UNIX in anger - a lost age of innocence and proper computing....

loydb
Posts: 178
Joined: Wed Jan 06, 2010 9:28 pm

Re: SQL Question...

Post by loydb » Wed Dec 19, 2012 4:14 pm

ian_halsall wrote:trouble is with mysql is that not many people use it in industrial strength applications
You mean, like Facebook?

The Fortune 50 (not 500, 50) that I work for is almost exclusively a MySQL shop. Unless you *know* that the company you work at (or want to work at) is an Oracle shop (financial services, in particular, are attracted to Oracle because of its amazing robustness), a deep knowledge of MySQL will serve you well, and 90% of the knowledge you gain will be applicable to Oracle anyway.
MFOS Ultimate Expand-o-tron Build Log: http://www.electro-music.com/forum/view ... 797#308797
MFOS Mini-Controller Build Log [FINISHED!]: http://www.electro-music.com/forum/view ... hp?t=42968

DIgiDennis
Posts: 142
Joined: Thu Jul 13, 2006 7:07 am
Location: DK - 1659

Re: SQL Question...

Post by DIgiDennis » Wed Dec 19, 2012 4:24 pm

and wikipedia, google, youtube! & flikr

ttilberg
Posts: 587
Joined: Wed Oct 05, 2011 4:55 pm
Contact:

Re: SQL Question...

Post by ttilberg » Wed Dec 19, 2012 4:34 pm

H20nly wrote:Cygwin :x i've had other... issues... with that shell of despair.



thanks for added info Angstrom.
loydb - you're awesome! i can't thank you enough for the points of reference and instructions.

i was having my doubts about the info i was going to get from starting this thread. i am pleased at how helpful you have all been. i am most grateful to you all for taking the time... if any of you are every near Berkeley or Oakland... make sure to send a PM. the first drink is definitely on me. :D
must... find... reason... to... leave... tundra...
Tim Tilberg - Duluth, MN | SoundCloud - Arsenal
2011 13" MBP w/8GB ram | Live 9 Suite, Reason 6.5, FXPansion DCAM/Etch/Maul, Izotope Ozone 5

Angstrom
Posts: 14926
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

Re: SQL Question...

Post by Angstrom » Wed Dec 19, 2012 4:38 pm

loydb wrote:
ian_halsall wrote:trouble is with mysql is that not many people use it in industrial strength applications
You mean, like Facebook?

The Fortune 50 (not 500, 50) that I work for is almost exclusively a MySQL shop. Unless you *know* that the company you work at (or want to work at) is an Oracle shop (financial services, in particular, are attracted to Oracle because of its amazing robustness), a deep knowledge of MySQL will serve you well, and 90% of the knowledge you gain will be applicable to Oracle anyway.
I can understand Loydb's point and it's valid, to learn the complete system makes sense.
Although on a personal / day-to-day working level I've never been troubled by the limitations of mySQL.

So for learning completeness, yes SQL. For actual work on jobs, most people find themselves operating within some variant or other. Foe example : Many applications use SQLite for their internal data, such as DAW browsers ;-)

crumhorn
Posts: 2503
Joined: Fri Sep 26, 2008 6:04 pm

Re: SQL Question...

Post by crumhorn » Wed Dec 19, 2012 4:43 pm

If you ever intend to do any Android Apps then learn sqlite. It's a standard part of the framework.
"The banjo is the perfect instrument for the antisocial."

(Allow me to plug my guitar scale visualiser thingy - www.fretlearner.com)

ian_halsall
Posts: 1715
Joined: Fri May 27, 2011 8:52 am
Location: South London
Contact:

Re: SQL Question...

Post by ian_halsall » Wed Dec 19, 2012 4:49 pm

I work in London in finance - nobody uses mysql here - nobody - everyone uses Sybase, Sql server or Oracle.

The core sql language is pretty much the same across all vendors being some descendant of ansi 92 but there are differences - significant in the case of triggers and stored procedures (does mysql even have these?) - so best to pitch your learning to the market you intend to work in.

If you're going to work at Google (whoever they are) then learn mysql.

And BTW - mysql is only free for non-commercial use.

Angstrom
Posts: 14926
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

Re: SQL Question...

Post by Angstrom » Wed Dec 19, 2012 5:09 pm

ian_halsall wrote: And BTW - mysql is only free for non-commercial use.
no, that's a reduction or misunderstanding of the GPL.

http://www.xaprb.com/blog/2009/02/17/wh ... l-license/
Here are some things the GPL allows:

The GPL allows you to run a for-profit business on MySQL.
The GPL allows you to modify the MySQL source code in any way you want.
The GPL allows you to sell MySQL.
The GPL allows you to redistribute MySQL.
The GPL allows you to redistribute your modifications of MySQL.

And you don’t have to ask anyone’s permission or pay anyone for the right to do this. Are you shocked? You shouldn’t be.

The above come with some restrictions, but those restrictions are (broadly speaking) only to prevent you from making the software less Free. So, for example, if you sell or redistribute, you have to do it under the GPL too. You cannot strip the GPL or encumber part of the software and then pass on a less-Free version of the software to others.

Here are some things the GPL does not require:

The GPL doesn’t require you to redistribute your modifications to MySQL.
The GPL doesn’t require you to GPL-license any software that merely connects to MySQL.
The GPL doesn’t require you to GPL-license all the software in your company.

So if you have to buy a commercial license for things the GPL doesn’t permit, what are those? Here are a couple of scenarios I can think of.

You need a commercial license if you want to modify MySQL and redistribute the result as non-Free software.
You need a commercial license if you want to embed MySQL within your non-Free program. Note that embed is not the same as “make a connection to.”
So making a commercial website which uses mySQL as a backbone does not require a commercial license.

I have been making commercial sites on mySQL since about y2k

crumhorn
Posts: 2503
Joined: Fri Sep 26, 2008 6:04 pm

Re: SQL Question...

Post by crumhorn » Wed Dec 19, 2012 5:36 pm

stored procedures are inherently evil. Application logic all jumbled up with the data model... evil!
"The banjo is the perfect instrument for the antisocial."

(Allow me to plug my guitar scale visualiser thingy - www.fretlearner.com)

DIgiDennis
Posts: 142
Joined: Thu Jul 13, 2006 7:07 am
Location: DK - 1659

Re: SQL Question...

Post by DIgiDennis » Wed Dec 19, 2012 5:51 pm

ian_halsall wrote: triggers and stored procedures (does mysql even have these?)
I belive both are supported since version 5

ian_halsall
Posts: 1715
Joined: Fri May 27, 2011 8:52 am
Location: South London
Contact:

Re: SQL Question...

Post by ian_halsall » Wed Dec 19, 2012 7:40 pm

perhaps the best argument for using sql server is that you can build windows desktop applications in a few minutes using the free sql express.

with super tight binding into dot net it makes application development a breeze

after all - you can't actually do anything purely with sql

not quite as good as sql server but Oracle has odp.net which I use every day

Post Reply