SQL "scratch- to- pro"
- Get link
- X
- Other Apps
Using SQL as a junior data analyst
In this reading, you will learn more about how to decide when to use SQL, or Structured Query Language. As a data analyst, you will be tasked with handling a lot of data, and SQL is one of the tools that can help make your work a lot easier. SQL is the primary way data analysts extract data from databases. As a data analyst, you will work with databases all the time, which is why SQL is such a key skill. Let’s follow along as a junior data analyst uses SQL to solve a business task.
The business task and context
The junior data analyst in this example works for a social media company. A new business model was implemented on February 15, 2020 and the company wants to understand how their user-growth compares to the previous year. Specifically, the data analyst was asked to find out how many users have joined since February 15, 2020.

Spreadsheets functions and formulas or SQL queries?
Before they can address this question, this data analyst needs to choose what tool to use. First, they have to think about where the data lives. If it is stored in a database, then SQL is the best tool for the job. But if it is stored in a spreadsheet, then they will have to perform their analysis in that spreadsheet. In that scenario, they could create a pivot table of the data and then apply specific formulas and filters to their data until they were given the number of users that joined after February 15th. It isn’t a really complicated process, but it would involve a lot of steps.
In this case, the data is stored in a database, so they will have to work with SQL. And this data analyst knows they could get the same results with a single SQL query:

Spreadsheets and SQL both have their advantages and disadvantages:
Features of Spreadsheets | Features of SQL Databases |
|---|---|
Smaller data sets | Larger datasets |
Enter data manually | Access tables across a database |
Create graphs and visualizations in the same program | Prepare data for further analysis in another software |
Built-in spell check and other useful functions | Fast and powerful functionality |
Best when working solo on a project | Great for collaborative work and tracking queries run by all users |
When it comes down to it, where the data lives will decide which tool you use. If you are working with data that is already in a spreadsheet, that is most likely where you will perform your analysis. And if you are working with data stored in a database, SQL will be the best tool for you to use for your analysis. You will learn more about SQL coming up, so that you will be ready to tackle any business problem with the best tool possible.
SQL dialects and their uses
In this reading, you will learn more about SQL dialects and some of their different uses. As a quick refresher, Structured Query Language, or SQL, is a language used to talk to databases. Learning SQL can be a lot like learning a new language — including the fact that languages usually have different dialects within them. Some database products have their own variant of SQL, and these different varieties of SQL dialects are what help you communicate with each database product.
These dialects will be different from company to company and might change over time if the company moves to another database system. So, a lot of analysts start with Standard SQL and then adjust the dialect they use based on what database they are working with. Standard SQL works with a majority of databases and requires a small number of syntax changes to adapt to other dialects.
As a junior data analyst, it is important to know that there are slight differences between dialects. But by mastering Standard SQL, which is the dialect you will be working with in this program, you will be prepared to use SQL in any database.
More information
You may not need to know every SQL dialect, but it is useful to know that these different dialects exist. If you are interested in learning more about SQL dialects and when they are used, you can check out these resources for more information:
LearnSQL’s blog, What Is a SQL Dialect, and Which One Should You Learn?
Software Testing Help’s article, Differences Between SQL Vs MySQL vs SQL Server
Datacamp’s blog, SQL Server, PostgreSQL, MySQL... what's the difference? Where do I start? Note that there is an error in this blog article. The comparison table incorrectly states that SQlite uses subqueries instead of window functions. Refer to the SQLite Window Functions documentation for proper clarification.
SQL Tutorial’s tutorial, What is SQL
ntroduction to SQL language
SQL is a programming language designed to manage data stored in a relational database management system (RDBMS).
SQL stands for the structured query language. It is pronounced as /ˈɛs kjuː ˈɛl/ or /ˈsiːkwəl/.
SQL consists of a data definition language, data manipulation language, and a data control language.
- The data definition language deals with the schema creation and modification e.g., CREATE TABLE statement allows you to create a new table in the database and the ALTER TABLE statement changes the structure of an existing table.
- The data manipulation language provides the constructs to query data such as the SELECT statement and to update the data such as INSERT, UPDATE, and DELETE statements.
- The data control language consists of the statements that deal with the user authorization and security such as GRANT and REVOKE statements.
SQL Standard
SQL was one of the first commercial database languages since 1970. Since then different database vendors implemented SQL in their products with some variations. To bring greater conformity between the vendors, the American Standards Institute (ANSI) published the first SQL standard in 1986.
ANSI then updated the SQL standard in 1992, known as SQL92 and SQL2, and again in 1999 as SQL99 and SQL3. Every time, ANSI added new features and commands into the SQL language.
The SQL Standard is now maintained by both ANSI and international Standards Organization as ISO/IEC 9075 standard. The latest release standard is SQL:2011.
The SQL standard formalizes SQL syntax structures and behaviors across database products. It becomes even more important to the open source databases such as MySQL and PostgreSQL where the RDBMS are developed mainly by the communities rather than big corporations.
SQL Dialects
The community constantly requests for the new features and capabilities that do not exist in the SQL standard yet, therefore, even with the SQL standard in place, there are many SQL dialects in various database products.
Because ANSI and ISO have not yet developed these important features, RDBMS vendors (or communities) are free to invent their own new syntax structure.
The following are the most popular dialects of SQL:
- PL/SQL stands for procedural language/SQL. It is developed by Oracle for the Oracle Database.
- Transact-SQL or T-SQL is developed by Microsoft for Microsoft SQL Server.
- PL/pgSQL stands for Procedural Language/PostgreSQL that consists of SQL dialect and extensions implemented in PostgreSQL
- MySQL has its own procedural language since version 5. Note that MySQL was acquired by Oracle.
In each tutorial, we will explain the SQL syntax structures and behaviors that are valid across the databases. We also will discuss the exceptions if they exist in a particular database.
SQL, or Structured Query Language, is the standard language for interacting with relational databases. With SQL, you can query, or ask questions of, the data in a relational database. Working with SQL and relational databases is an invaluable skill set for a data analyst, data engineer, or a data scientist.
If you have started looking for ways to learn SQL, you may have noticed the many different dialects of SQL available to learn with some clear (and less clear) distinctions between the different dialects. So where do you begin? Which version of SQL is most helpful to you if you haven’t used it before? In this article, we will focus on four of the most popular database management systems -- PostgreSQL, MySQL, SQLite, and SQL Server -- and their versions of SQL syntax.
The graph below from Stack Overflow Trends provides a sense of how often each of these platforms is discussed -- each line represents the percentage of all Stack Overflow questions about each version of SQL.

MySQL has consistently been the most popular version of SQL in Stack Overflow questions. Second in line is Microsoft SQL Server (including T-SQL, the name of Microsoft’s dialect of SQL), which remains a consistently more popular tag than PostgreSQL and SQLite. This means that if you have a question specific to one of these systems, you’re more likely to find that someone already asked your question.
What’s the difference?
PostgreSQL, MySQL, and SQLite use very similar syntax, with some notable differences highlighted below. Microsoft SQL Server has the greatest contrast in SQL syntax, as well as a wide variety of functions not available in other platforms. The table below highlights some examples of basic differences between SQL platforms.
| SQL Server | MySQL | PostgreSQL | SQLite | |
|---|---|---|---|---|
| SELECT ... | Select [col1], [col2] | SELECT col1, col2 | SELECT col1, col2 | SELECT col1, col2 |
| Data from tables is case sensitive? | Yes WHERE name = ‘John’ Or WHERE name = ‘john’ are not the same | No WHERE name = ‘John’ Or WHERE name = ‘john’ are the same | Yes WHERE name = ‘John’ Or WHERE name = ‘john’ are not the same | Yes WHERE name = ‘John’ Or WHERE name = ‘john’ are not the same |
| Using quotation marks | name = ‘John’ only | name = ‘John’ or name = “John” | name = ‘John’ only | name = ‘John’ or name = “John” |
| Aliases for columns and tables | SELECT AVG(col1)=avg1 | SELECT AVG(col1) AS avg1 | SELECT AVG(col1) AS avg1 | SELECT AVG(col1) AS avg1 |
| Working with dates | GETDATE() DATEPART() | CURDATE() CURTIME() EXTRACT() | CURRENT_DATE() CURRENT_TIME() EXTRACT() | DATE(‘now’) strftime() |
| Window functions i.e., OVER(), PARTITION BY() | Yes | Yes | Yes | No (need to use subqueries instead) |
Where do I start?
For students who have little to no experience with SQL and are looking to gain the most broadly applicable skills, I recommend starting with PostgreSQL. Despite the overwhelming popularity of MySQL, PostgreSQL may be a better choice because its syntax most closely conforms to Standard SQL. This means that you can easily translate your skills to other database management systems such as MySQL or SQLite. For example, the query below aggregates data from a database of sales information. It contains a join, an aggregate function, and a filter. This syntax will generate identical results in all three database systems.
Select
c.customer_name,
SUM(p.amount) AS total_sales
FROM customers AS c
LEFT JOIN purchases AS p
ON c.customers_id = p.customer_id
WHERE
c.customer_location = 'USA'
GROUP BY
c.customer_name;
If you anticipate working with Microsoft SQL Server in your career, I recommend you start by learning T-SQL/Microsoft SQL. SQL Server continues to maintain a sizable market share and is an important database management system in many industries. If you are unsure which of these two is more important for you, I recommend browsing through job openings in your field to determine if there is a preference for a specific database system in specific roles or industries.
How can DataCamp help?
At DataCamp, we currently offer two courses in SQL that cover introductory topics and joins in PostgreSQL. We have some exciting courses in development covering intermediate and advanced topics in PostgreSQL. We also have several SQL Server courses in development, including an Introduction to T-SQL/Microsoft SQL course that will provide you with a clear foundation for working with SQL Server. You can check out our course roadmap for more information.
If you’re looking to practice interacting with a PostgreSQL database on your own, I recommend exploring data sets on Kaggle. If you find something that interests you, go ahead and import into PostgreSQL (CSV or SQLite files will import into PostgreSQL) and start exploring!
Difference Between SQL and MySQL in Table Format
| SQL | MySQL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| SQL is Structured Query Language used to manage the relational databases. | MySQL is a relational database management system used to store, retrieve, modify and administer a database using SQL. We have a lot of database software available in the market. The popular ones include MySQL, SQL Server, Oracle, Informix, etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| It’s a query language. | It’s database software. It uses SQL as a language to query the database. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Since this is a language, it does not get updates. SQL commands always remain the same.
Difference Between SQL and MySQL CommandsUnder this topic, we will be discussing the differences between MS SQL Server commands and MySQL commands. There are some variations in the commonly used SQL code in both of these relational database management systems.
MySQL vs SQL Server PerformanceFor high-end applications, both MYSQL and SQL Server offer a similar level of speed and performance. Both have the capacity to host several databases on one server. They make use of indexes to sort data and accelerate performance. A few years ago, IJARCCE (International Journal of Advanced Research in Computer and Communication Engineering) published a comparative performance analysis done between MySQL and SQL Server. Different SELECT, INSERT, DELETE and UPDATE queries were executed on both the RDBMS on Windows system and their execution time was recorded. It was concluded that SQL Server offers better performance than MySQL in terms of response time. Except for the INSERT queries, SQL Server consistently took lesser time for all the other test cases as against MySQL. In terms of scaling up, MySQL showed two times increase in time when the number of rows went up. SQL Server also showed an increase in time, but it was not as much as MySQL. Thus, SQL Server scales better than MySQL. The most significant difference between the two was seen in terms of SELECT statements. For 3000 rows SELECT statement, MySQL took almost 3 times of the time taken by the SQL Server. You can have a look at the below comparison charts: Averages for a non-conditional SELECT query Averages for SELECT query having an ORDER clause on a non-indexed field Averages for SELECT query with a JOIN Averages for SELECT query having a JOIN and an ORDER clause on a non-indexed field Averages for 100 INSERT queries Averages for conditional DELETE query Averages for non-conditional DELETE query Averages for conditional UPDATE query Averages for non-conditional UPDATE query [image source] Which is Better – MySQL or SQL Server?While thinking about which one is better out of MySQL and Microsoft SQL Server, it will depend upon your use cases, budget and perspective. Both are effective in organizing your data and they make it readily accessible through a user interface. Both the technologies work on the concept of storing data as per schema (table storage). MySQL is inclined more towards selecting the data to facilitate data display, update and save the data again. It is a bit weaker than SQL Server in terms of data insertion and deletion. However, it’s a great choice for data storage and referencing data. Also, MySQL is not so much rich in terms of development functions and capabilities. Talking about the security features, both the technologies are EC2 complaint. But, Microsoft SQL server has an edge in offering overall security features. In SQL Server, there is a tool called Baseline Security analyzer that aids administrators to make sure that SQL server installation is up to date. In MySQL, there is no such security analyzer. Considering the support, the respective vendors for both the systems provide support in paid as well as free form. As MYSQL is now owned by Oracle, it offers support through technical assistance and Virtual MySQL DBA assistant. Then again, Microsoft provides solid assistance over its SQL database and cloud storage. It offers a free assistant called SSMA (SQL Server Migration Assistant) which makes it simple and easy to migrate the data from other DBMS like Oracle, MySQL, Microsoft Access and Sybase to SQL Server. Moreover, MS SQL Server offers ETL functionality which is not there in MySQL. Overall, as per my perspective, SQL server is better than MySQL, but it is more expensive because of its amazing features. If you are a large enterprise with massive data and concerned about speed, security and power, and most importantly if you have enough budget, then I would suggest going with SQL Server. For individual users and small to medium-sized companies where the amount of data and work required is not that massive, you can go with MySQL. Again, Microsoft offers SQL server express to cater to the needs of a small organization. The express edition is also free. Thus, SQL server can serve all type of needs. But, MySQL can handle only up to medium level enterprise and where you need to optimize expenditure. Hence, the choice will depend upon your requirements. What is the difference between SQL and MS SQL? Answer: The main difference between SQL and MS SQL is that SQL is a query language that is used in relation databases whereas MS SQL Server is itself a relational database management system (RDBMS) developed by Microsoft. A query language is basically used for retrieval and modification of information stored in databases. A DBMS is a software that is used to manage the database. Basically, it’s a collection of programs, features, and capabilities that allow you to interact with the database so as to perform tasks related to data definition, data updating, data retrieval, and user administration. A RDBMS is a database management system with row-based table structure. Most of the commercial RDBMS use SQL to interact with the database. Basic syntax for aliasingAliasing is the process of using aliases. In SQL queries, aliases are implemented by making use of the AS command. The basic syntax for the AS command can be seen in the following query for aliasing a table: ![]() Notice that AS is preceded by the table name and followed by the new nickname. It is a similar approach to aliasing a column: ![]() In both cases, you now have a new name that you can use to refer to the column or table that was aliased. Alternate syntax for aliasesIf using AS results in an error when running a query because the SQL database you are working with doesn't support it, you can leave it out. In the previous examples, the alternate syntax for aliasing a table or column would be:
The key takeaway is that queries can run with or without using AS for aliasing, but using AS has the benefit of making queries more readable. It helps to make aliases stand out more clearly. Aliasing in actionLet’s check out an example of a SQL query that uses aliasing. Let’s say that you are working with two tables: one of them has employee data and the other one has department data. The FROM statement to alias those tables could be: ![]() These aliases still let you know exactly what is in these tables, but now you don’t have to manually input those long table names. Aliases can be really helpful for long, complicated queries. It is easier to read and write your queries when you have aliases that tell you what is included within your tables. For more informationIf you are interested in learning more about aliasing, here are some resources to help you get started:
| Since it’s a software, it gets frequent updates. |
- Get link
- X
- Other Apps




















Comments
Post a Comment