The Best Way To Learn SQL
- Storage of data
- Modification of data
- Retrieval of data
- Data deletion
- Generation of tables and other database projects.
How Hard Is It To Learn SQL
SQL is database layer query language and is not very difficult to learn. It does not require any prior programming experience to learn SQL queries. Learning SQL can be really easy if you already know a programming language. The fastest way to learn SQL is to start learning by doing it.
History Of SQL
A paper styled “A Relational Model of Data for Large Shared Data Banks” by Edgar F. Codd written in 1970 defined the relational database model. It became the basis for developing the SQL.
Codd was a researcher associated with IBM. Based on his findings, in 1974 IBM began working on a new language for relational database management systems. The new language was originally called SEQUEL, or Structured English Query Language.
The language went through a few modifications, implementations and the name was also changed a few times before it was finally called SQL. Subsequently many SQL-based offerings hit the market where IBM had a key role to play. SQL is a language which is easy for beginners to learn than other programming languages like Java, C++, PHP or C#.
Some of the relational database management systems which use SQL are: Oracle, Sybase, Microsoft SQL Server, Access, Ingres etc. Most database systems use SQL. Most of them have their own proprietary extensions that are usually used only on their system.
“Select”, “Insert”, “Update”, ”Delete”, “Create” and “Drop” are the standard SQL commands which can be used to achieve almost everything that one needs to do with a database. For those students who want to learn programming from scratch many free online courses will be of help.
Step 1: Strong Determination To Learn
Not every person loves SQL and hence, many of your friends and family will try their level best to discourage you from learning the language. It is true that the world of programming is flooded with different competing languages and it is not really possible to pick the one which is the best. A language which works perfectly for you might not serve the same purpose for someone else.
Hence, instead of paying attention to what the critics of SQL have to say, you must focus all your attention on learning the language you picked.
Know About Types Of Jobs And Skill Required For SQL
Here are some of the positions that require applicants to have SQL skills:
The data base developer should have the experience and the skills such as with Spring, XML, PL/SQL, Apache Camel, and Agile Methodologies. He or she also should have the ability to work closely with applications and web developers. Excellent problem solving skills and strong relationship management skills are added advantage.
Database Administrator (DBA)
The data base administrator should have the ability to with the computers that has the data. He should understand how computers store and retrieve data and also should have the knowledge to create a database. And the knowledge of database organization and how it affects the computer and network performance is a must for this position. Also must have the ability to solve the technical problems which is caused by the database design and malfunction.
The data base analyst should have the technical and soft skilss. Technical skills means a basic knowledge of statistics to a rigorous understanding of Machine Learning and the computer skills such as a Statistical Language (R, SAS, SPSS), a scripting Language (Python,Matlab), a Spreadsheet (Excel), and Querying Language (SQL,Hive,Pig). The soft skills needed are ; defining problem, knowing the audience and the delivery.
Data Warehouse Engineer
Data Warehouse Engineer should have the ability to dealing with people and the knowledge various aspects of data warehousing on the areas such as Overall end-to-end data warehousing architecture, understanding of client/server, server-side computing architectures and the understanding of database optimization concepts for tuning data access queries
SQL Reports Writer
SQL Reports Writer should have the overall knowledge of SQL and good communication skills, and various computer applications which are necessary for this position.
Step 2: Start Simple
Learning SQL can be frustrating and require a lot of hard work on reading and practicing queries and commands. Do not try to do everything at the beginning. Take it slow and learn simple queries first, than move to complex query writing.
Step 3: Install My SQL and My SQL Workbench
We have chosen MySQL since its simple, free and easy to learn. You can start with any database of your choice (if easily available). The below steps would still help you.
My SQL database is a open source and freely available database. You can easily download the My SQL server and its client workbench for quickly getting started.
Step 4: Learn SQL Fundamentals
Its important to learn the fundamental concept of SQL first. Once you know the basic you can do more advanced things on SQL easily.
An Overview Of Relational Database
A relational database system contains one or more objects that are called tables. The data for the database are stored in these tables. Tables comprise of rows and columns. Rows contain the records or data for the columns. Columns contain the column name, data type and any other attributes for the column.
In order to query the database and retrieve selected data that match the criteria the select statement is used. The column names which follow the select keyword determine which columns will be returned in the results. One can select as many column names as one wants or can use a “*” to select all columns. The table name that follows the keyword “from” specifies the table that will be queried to retrieve the desired results. The optional “where” clause indicates which data values or rows will be returned or displayed. It is done based on the criteria described after the keyword “where.”
“Create table” statement is used for creating a new table. In order to create a new table, the keywords “create table” must be used followed by the table name, an open parenthesis, the first column name, the data type for that column, any optional constraints and a closing parenthesis in order. Use of an open parenthesis before beginning the table and a closing parenthesis after the table is crucial. Each column definition should be separated with a comma. All SQL statements must end with a semi colon.
To insert or add a row of data into the table the “insert” statement is used. The keywords “insert into” must be used to insert records into a table followed by the table name, an open parenthesis, a list of column names separated by commas, a closing parenthesis, the keyword “values” followed by the list of values enclosed in parenthesis. The values will beheld in rows and they will match up with the specified column names.
For updating records the “update” statement is used. A “where” clause must be carefully constructed for this purpose. In order to delete records or rows from the table the “delete” statement is used. If the “where” clause is left all records will be deleted. To delete a table and all rows in a table the “drop table” command is used. Drop table is different from deleting all the records in a table. Only column and constraint information remain when all of the records in the table are deleted. Table definition and all rows get removed when dropping the table.
Step 5: Read Some Good Books from Experts
Step 6: Start Writing and Running Simple Queries
Write simple queries on My SQL and observe the results. Some simple query exercise that you can try are listed below resources
- SQL Exercise By Stanford A course by stanford university requires the students to do following exercises.
- SQL Zoo Tutorials This tutorial contains some basic exercise that you can start with.
- MySQL Exercises, Practice, Solution
Step 7: Simple In Not Enough : Try Complex Queries and Performance Improvements
Once you feel comfortable on simple queries and practice exercises you can move to complex queries. At this stage, I will recommend you to start focusing on performance aspect of queries. Try to write and query that perform better. There are many ways to write SQL query however the performance may change. You need to write the queries efficiently that can return results is short time.
Learning SQL is a very important step in developing our database skills. If one has all his data in SQL database, he needs to know how to retrieve it properly. It is also essential to know how to leverage the power of SQL to perform advanced table joins and other complex queries. Databases can be manipulated using the Data Manipulation Language (DML) which is a subset of SQL. One will be able to learn how to create databases and tables, delete data from databases and comprehend other complexities such as NULL values. A very common use of SQL is to perform searches against large volumes of data. Searching is made easy with many operators of SQL. The users just need to be aware of the multiple options available and they should be able to decide which technique is the best for them in a given situation. These tips should be practiced on a regular basis especially when writing queries.