Page 1 of 3

SQL Question...

Posted: Thu Dec 13, 2012 6:46 pm
by H20nly
any of you two timing digislave by day musician by night types proficient in SQL?

if so, do you have any recommendations on learning the language?

it's the only hole in my resume that i really need to fill... i'd love to learn it... and have enough technical experience that i can talk the talk so i don't need a certificate... i just need to know the language.

thanks in advance for any help/recommendations.

H


P.S. i know Access and currently design GUIs for SQL... but i want to get deeper under the hood.

Re: SQL Question...

Posted: Fri Dec 14, 2012 11:48 pm
by H20nly
bump

Re: SQL Question...

Posted: Sat Dec 15, 2012 1:44 am
by crumhorn
select first_name, last_name from forum_users where skill_name = 'SQL' and expert = true order_by post_count desc;

Re: SQL Question...

Posted: Mon Dec 17, 2012 4:48 pm
by H20nly
:lol:

damn it man!!

it was worth a try...

Re: SQL Question...

Posted: Mon Dec 17, 2012 5:23 pm
by crumhorn
I know a bit but I'm certainly no expert, It get's ugly pretty fast when you want to ask awkward questions. Since I discovered RAILS and Active Record I avoid SQL as much as possible.

A good way to learn is to download and install a copy of mySQL or sqlite and play around with it while working through the documentation. think of a useful project and have a crack at it.

Re: SQL Question...

Posted: Mon Dec 17, 2012 6:07 pm
by H20nly
8) thanks for that.

Re: SQL Question...

Posted: Mon Dec 17, 2012 9:43 pm
by ttilberg
H20, definitely the best way to learn it is to make a dummy db and mess around with it. You definitely need to have some sort of a test project in mind for SQL. The way I learned is basically coming across situations like "okay I need to organize this data this other way" and Googling it. After a few runs through it starts to stick. A helper program also makes a great set of training wheels:
If you are using MS SQL Server, you can download SQL Express for free, and it comes with "Management Studio" which is a great set of training wheels, immediately telling you where you have bad syntax.
If you are using MySQL, take a look at phpMyAdmin. There are probably other options out there, but those are the two I've always used.

Proper DBA stuff though, like management and maintenance is a different beast though.

Maybe consider starting with a very simple application that tracks account balances or something. My first project that I got cooking with SQL was a php web app I made to track if my room mates payed me their cable bill money, and to print them receipts. This simple project gives you all sorts of awesome experience with basic selection, inserting, sorting, etc.

Good luck!

Re: SQL Question...

Posted: Mon Dec 17, 2012 9:51 pm
by jbodango

Re: SQL Question...

Posted: Mon Dec 17, 2012 9:59 pm
by H20nly
thanks guys. that's great.

i've been needing to take some classes or study up, but i've been putting it off. what made me ask the other day is that i was working on a GUI and created a field that needed to be numeric, but i made it text... and then a field that needed to be decimal, but that i made numeric. without being able to go into the SQL and change the field type (i just created them so I KNOW there is no data in them) they will forever more be an eye sore when i create macros for the documents that will refer to them later. :x

experience is something you get right after you make a mistake... it's nice if someone will help guide you beyond their first few missteps.

thanks again for the advice.

Re: SQL Question...

Posted: Tue Dec 18, 2012 3:25 pm
by loydb
The best way to learn it is to get VMWare, or Parallels, or whatever virtual machine environment you want. Download a turnkey LAMP image (http://www.turnkeylinux.org/lampstack). Boot that puppy up and start playing. This way, you're using SQL in the context you're most likely to IRL -- in an Apache environment with Perl, Python, PHP, Ruby, whatever floats your boat (I'm partial to Perl myself, but I'm an old man...). The biggest thing to remember if you're using the command-line MySQL interface is that you need a ; at the end or the statement won't execute... :)

There are a million "learn SQL" tutorials on the web. O'Reilly also has some good LAMP stack books, look at safaribooksonline.

In your specific case, you can do (MySQL):
SHOW CREATE TABLE tablename;

This gives you the SQL code that can be used to re-create your table. If you've already got data in it, look for 'mysqldump' so you can preserve the data as well. Stick this into the file fixtable.sql, and change the type for the field you want.

Once you have the table creation script, you can delete the original table with:
DROP TABLE tablename;

Then, from a shell prompt (not from the mysql command line), do
mysql -uroot -p < fixtable.sql

It will prompt you for the password, then execute the SQL code in the file, giving you a spiffy new table.

You are correct to want to learn this. SQL is one of the few things that I've used in nearly every professional engagement I've had since the late 80s/early 90s. Once you know it on one system, it's pretty easy to pick up the variations (e.g. SQL Server vs. PostGres vs. MySQL vs. Access).

Good luck!

Re: SQL Question...

Posted: Tue Dec 18, 2012 3:31 pm
by ian_halsall
Sadly I am an expert in SQL of almost 2 decades (f*ck).

It's not that difficult - download sql server express - free - it will run on a decent laptop or desktop.

Create a simple relation structure.

Usual crap is employees, managers, address, payroll.

Start selecting, updating, deleting.

Oracle, sql server, sybase - they're all much the same from a raw sql perspective although the differ in stored procedure implementation - I used them all.

I never used a book or found one that useuful - SQL is quite simple - relational design is more difficult.....

Re: SQL Question...

Posted: Tue Dec 18, 2012 3:48 pm
by crumhorn
Rule of thumb for Relational Design - remember that every attribute in a table should be dependent on "The key, the whole key and nothing but the key"

Re: SQL Question...

Posted: Tue Dec 18, 2012 5:39 pm
by H20nly
^ indeed!

thanks guys. more great info.

@ loydb 8O extra Wow!! very nice. thank you. i'm tempted to try that later in the day with a boggus table... once i get done fighting off the support requests :x




pencils are the pinnacle of headache-less technology

Re: SQL Question...

Posted: Tue Dec 18, 2012 6:12 pm
by Angstrom
With regard to the suggestion of running paralells. I'm not sure you need an OS emulation layer.

I run Xampp on a windows box, also available to run on Linux, and Osx .

It will install all you need and you can toy around in the interface of PHPmyadmin, which is a quite standard method of interacting with that variant of SQL.

http://www.apachefriends.org/en/xampp.html
The distribution for Windows 2000, 2003, XP, Vista, and 7. This version contains: Apache, MySQL, PHP + PEAR, Perl, mod_php, mod_perl, mod_ssl, OpenSSL, phpMyAdmin, Webalizer, Mercury Mail Transport System for Win32 and NetWare Systems v3.32, Ming, FileZilla FTP Server, mcrypt, eAccelerator, SQLite, and WEB-DAV + mod_auth_mysql.
It's a simple install.

Re: SQL Question...

Posted: Tue Dec 18, 2012 6:53 pm
by crumhorn
also don't forget cygwin for a linux type environment that runs under windows, contains all things LAMP and RAILS related -> http://www.cygwin.com/