ezoic

Monday, June 13, 2016

How to learn SQL quickly

How to learn SQL quickly?

SQL is an easy database language to pull data from database, and make calculations etc.  on it. It has many editions, MySQL, Netezza, Oracle. Big data's hive is a form of SQL too. If you write a resume, just mention SQL, do not write something like MySQL, Netezza etc. It does not seem professional if you write so.All of the different SQL languages have slight difference on syntax, but in general, they are the same. If you master one SQL language, you will learn other SQL languages quickly.

It is called structured query language:

https://en.wikipedia.org/wiki/SQL


To learn it, you can learn some tutorials and practice on it. Here are two good tutorials:

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

http://www.tutorialspoint.com/sql/sql_tutorial.pdf

And then, you can practice it, you can practice online, like the following. And you do not need to install anything further on your computer:


http://sqlfiddle.com/

https://www.sqlteaching.com/



Or, you are into computer, you can install  MySQL on your computer. It is free. I write down how to install MySQL on windows ( most complicated one), Mac, and Linux (easiest one, but you need to have Linux installed):

http://easyprog99.blogspot.com/2014/07/how-i-get-mysql-on-mac.html

http://easyprog99.blogspot.com/2016/06/how-to-install-mysql-workbench-on.html

http://easyprog99.blogspot.com/2016/01/how-to-install-mysql-on-linux.html


And then you can practice and learn SQL step by step:

1. You need to create some tables, using the following query:

http://dev.mysql.com/doc/refman/5.7/en/create-table.html

2.  You need to insert some data into the tables, using the insert, values query manually:

http://dev.mysql.com/doc/refman/5.7/en/insert.html



3. If you use Linux, you can insert data into tables by using infile, load:

http://dev.mysql.com/doc/refman/5.7/en/load-data.html



4. Try different types of queries: join, where, having, group by, drop, delete etc.


And if you are into computer and want to install Linux ( it is more convenient to use than windows, mac), here is a link:

http://easyprog99.blogspot.com/2016/04/one-way-to-install-linux-on-your-pc.html


Some usual SQL interview questions:

1. What's the difference between right, left, full join?
2. Relationship between having, group by, where? How to use having?

Here is an article for this question:

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


3. Some date functions on SQL


4. A SQL question on an onsite job interview:

We have the following data:

date           sales
09/01/2011      110
12/01/2011      100
01/03/2011      120
03/08/2011     200

We need to get the following report from the data:
                         Day 
Month      mon    tues    wed    thurs fri sat sun
jan           sales  sales   sales   ...
feb    ...
march  ...
...    ...

Write SQL query for this. 

5. Youtube has video play log like this:
Video ID, time
vid1 t1
vid2 t2
… …
The log is super large.
Find out the top 10 played videos on youtube in a given week.


6.A bank has this access log:
IP address, time
ip1 t1
ip2 t2
… …

If one ip accessed K times within m seconds, it may be an attack.
Given the log, identify all IPs that may cause attack.

7. Given some sessions and users data, try to find out, which session has the highest number of users:

2009-7-12 14:01','2009-7-12 15:01'
2,'2009-7-12 14:30','2009-7-12 14:45'
3,'2009-7-12 14:47','2009-7-12 15:30'
4,'2009-7-12 13:01','2009-7-12 17:01'
5,'2009-7-12 14:15','2009-7-12 18:01'
6,'2009-7-12 11:01','2009-7-12 19:01'
1,'2009-7-12 16:07','2009-7-12 19:01'

 



















4 comments:

  1. It is one of the easiest database to learn. Visit google and there you can get thousands of tutorial about Microsoft SQL. You can learn about SQL in just a week. If you are looking for the certification without training or exam then visit www.certwizard.com

    Regards,
    Crish Watson

    ReplyDelete
  2. how fast you will learn SQL depeds largely on what are the materials about - if they are focused on teching realistic problem solving, it's better for learning.


    cheers,
    academy.vertabelo.com

    ReplyDelete

looking for a man

 I am a mid aged woman.  I was born in 1980. I do not have any kid. no complicated  dating before . I am looking for a man here for marriage...