Let’s dive right in.
MySQL is the least like the others as it is a database manipulation language, whereas PHP, Ruby, and Python are programming languages.
First of all, we must understand what these languages are and are used for, so below is a short introduction:
- PHP: PHP is a server-side programming language mostly used for the web.
- Ruby: Ruby is a general-purpose programming language, but it is challenging to learn.
- Python: Python is also a general-purpose programming language, but it is easy to learn.
- MYSQL: It is an open-source relational database management system that uses SQL language for manipulating data in databases.
From this basic introduction, the first four seem to be programming languages and related whatsoever. On the other hand, the fifth is a data-based language that will manipulate data directly in the databases.
PHP can be used along with SQL, but SQL will be required. So, based on these facts so far, we can categorize all of these languages into:
- Programming languages
- Database manipulation language
1. Programming languages
What are programming languages? Programming languages are those computer languages that can instruct a machine to do something useful.
We are familiar with C, C++, or Java as some of the famous programming languages used for Computer Programming but those are not the only programming languages.
In fact, there are a lot of others. With the advent of the Operating System, one became able to extend the functionality by writing independent apps:
This concept has been extended to other software, e.g., nowadays, not only apps can be developed for an operating system, but apps can be developed for almost any app.
What does this mean? Let’s take Microsoft Word. It has some awesome features, but we might want our specific features implemented per our needs.
Although we cannot get the app’s source code, we can extend this app functionality by writing an “Add on” for the app, with which we can extend the functionality.
This is true for almost all apps these days.
The languages we are referring to in this article are related to the web mostly:
- Php is mostly used for server-side programming for Web development.
- Ruby is a general-purpose language that can be used for machine learning and some web apps.
- The same is the case for Python.
These four are programming languages and have some similarities, but there are differences concerning their features and syntax. Let’s try to look at a few of these differences.
<script> alert( 'Hello, world!' ); </script>
“Hello World” in PHP
<?php echo "Hello World!"; ?>
“Hello World” in Ruby
puts' Hello World!'
“Hello World” in Python
2. Object Orientation
PHP is also object-oriented.
Ruby is purely object-oriented, which means it does not have a functional or procedural paradigm.
Python is also object-oriented.
Below are a few examples.
<script> var x = 5; var y = 6; var z = x + y; </script>
<?php $txt = "Hello world!"; $x = 5; $y = 10.5; ?>
var1 = 5; var2 = '2'
x = 5 y = "John" print(x) print(y)
- for – loops through a block of code several times
- for/in – loops through the properties of an object
- for/of – loops through the values of an iterable object
- while – loops through a block of code while a specified condition is true
- do/while – also loops through a block of code while a specified condition is true.
PHP has the following loops:
- while – loops through a block of code as long as the specified condition is true
- do-while – loops through a block of code once, and then repeats the loop as long as the specified condition is true
- for – loops through a block of code a specified number of times
- foreach – loops through a block of code for each element in an array
Ruby has these loops:
- While Loops
- Until Loops
- Do/While Loops
- For Loops
- Conditionals Within Loops
Python has as loops:
- For loop, but it’s different than other languages For loops.
- The range() function To loop through a set of code a specified number of times, we can use the range() function. The range() function returns a sequence of numbers, starting from 0 by default, increments by 1 (by default), and ends at a specified number.
- else in for-loop, The else keyword in a for loop specifies a block of code to be executed when the loop is finished.
- The pass Statement for loops cannot be empty, but if you, for some reason, have a for loop with no content, put in the pass statement to avoid getting an error.
This was to show that there could be some syntax or feature differences, but all are programming languages.
They may also be different in case of the intended use, like one may be used for the web or some other purpose.
Let’s now have a look at the database languages.
Database manipulation languages
We have mentioned “MySQL” in this article and categorized it in the second category.
It is an open-source relational database management system that uses SQL language for manipulating data in databases.
The language we will refer to is SQL stands for Structured Query Language, which works with Databases that may be for any platform like MySQL, SQL Server, MS Access, Oracle, Sybase, Informix, Postgres, and other database systems. SQL language can be used with written statements to:
- To create tables in a database.
- To create columns, also called fields.
- To populate data against the fields called rows or tuples.
- To create relationships among different tables or entities.
- To produce different reports and much more.
Hey guys! It’s me, Marcel, aka Maschi. On MaschiTuts, it’s all about tutorials! No matter the topic of the article, the goal always remains the same: Providing you guys with the most in-depth and helpful tutorials!