Getting started with SQL
There are several SQL variants available in the market. For an established professional, it is easy to get it sorted, as they already tend to posses a history of usage of multiple SQL versions. But, in the case of a complete beginner it all boils down to three points, which are
- Ease of Installation
- Ease of Use
- Availability of Support & Knowledge repositories
Based on my research, I have compiled my opinion on the above categories and classified the SQL providers in below table
SQL Database Providers
SQL Provider | Ease of Installation | Ease of Use | Support & Knowledge Availability |
---|---|---|---|
Microsoft SQL Server | Easy (Basic & Custom options) | User-friendly (SSMS) | Strong community & extensive resources |
MySQL | Easy (Installer & Docker) | Web-based tools & CLI | Large community & abundant tutorials |
PostgreSQL | Moderate (Installers & Package Managers) | Robust CLI & pgAdmin | Active forums & comprehensive docs |
SQLite | Very easy (No installation) | Simple API | Good official documentation |
I have compiled the installation procedure for Microsoft SQL Server, and MySQL here based on the installation manuals provided by respective suppliers websites.
Installing Microsoft SQL and Setting Up for Practice
Windows Installation
- Download SQL Server:
- Go to the SQL Server Downloads page.
- Select either the Developer or Express edition and click Download now.
- Install SQL Server:
- Double-click the downloaded file (e.g.,
SQL2019-SSEI-Dev.exe
). - Choose the Basic installation type.
- Accept the License Agreement and click Install.
- Note down the instance name and connection string displayed at the end of the installation.
- Double-click the downloaded file (e.g.,
- Install SQL Server Management Studio (SSMS):
- On the completion screen, click Install SSMS.
- Download the SSMS installer and run it.
- Follow the prompts to complete the installation.
- Connect to SQL Server:
- Open SSMS from the Start menu.
- Click Connect in the Object Explorer panel.
- Use default server values to connect.
macOS Installation
For macOS, you can use Docker to run SQL Server:
- Install Docker:
- Download Docker from Docker's official site.
- Follow installation instructions for macOS.
- Pull SQL Server Image:
- Open Terminal and run:
docker pull mcr.microsoft.com/mssql/server
- Open Terminal and run:
- Run SQL Server Container:
- Start a new SQL Server container with:
Replace `YourStrong!Passw0rd` with a strong password of your choice.docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourStrong!Passw0rd' \ -p 1433:1433 --name sqlserver \ -d mcr.microsoft.com/mssql/server
- Start a new SQL Server container with:
- Connect to SQL Server:
- Use a tool like Azure Data Studio or SSMS (available on Windows) to connect using `localhost` as the server name and `SA` as the username.
Linux Installation
You can also use Docker or install directly:
Using Docker:
- Install Docker:
- Follow instructions from Docker's official site.
- Pull SQL Server Image:
- Run SQL Server Container:
docker pull mcr.microsoft.com/mssql/server
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=YourStrong!Passw0rd' \
-p 1433:1433 --name sqlserver \
-d mcr.microsoft.com/mssql/server
Direct Installation:
- Add Microsoft Repository:
- Install SQL Server:
- Configure SQL Server:
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17
sudo apt-get install -y mssql-tools unixodbc-dev
sudo /opt/mssql/bin/mssql-conf setup
After installing SQL Server on your preferred operating system, you can start practicing by creating databases, tables, and executing queries using SSMS or other database management tools.
Installing MySQL and Setting Up for Practice
Windows Installation
- Download MySQL Installer:
- Visit the MySQL Downloads page.
- Choose the appropriate installer:
mysql-installer-web-community-8.0.x.msi
for a web-based installation.mysql-installer-community-8.0.x.msi
for a full installer.
- Install MySQL:
- Double-click the downloaded
.msi
file. - Follow these steps:
- Choose Setup Type: Select "Full" or "Developer Default".
- Check Requirements: The installer will check system requirements and automatically resolve any issues.
- Installation: Click "Execute" to install the selected products.
- Product Configuration:
- Choose "Standalone MySQL Server".
- Set the configuration type to "Development Computer" and connectivity to "TCP/IP" on port
3306
.
- Authentication Method: Choose "Use Strong Password Encryption for Authentication".
- Accounts and Roles: Set a password for the root account.
- Windows Service: Keep default settings to configure MySQL as a Windows service.
- Apply Configuration: Click "Execute" to apply the configuration.
- Double-click the downloaded
- Verify Installation:
- Open the MySQL Command Line Client from the Start menu.
- Enter your root password to access the MySQL server.
macOS Installation
- Download MySQL DMG Archive:
- Visit the MySQL Community Downloads page.
- Download the DMG archive for macOS.
- Install MySQL:
- Open the downloaded DMG file and run the installer package.
- Follow these steps:
- Accept the license agreement.
- Choose the installation type and click "Install".
- Enter your macOS password when prompted.
- Start MySQL Server:
- Use System Preferences > MySQL to start/stop the server.
- Alternatively, use Terminal:
.sudo /usr/local/mysql/support-files/mysql.server start
- Verify Installation:
- Open Terminal and run:
.mysql -u root -p
- Enter your root password to access the MySQL shell.
- Open Terminal and run:
Linux Installation
You can install MySQL using package managers or Docker.
Using APT (Debian/Ubuntu):
- Update Package Index:
- Install MySQL Server:
- Secure MySQL Installation:
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
- Follow prompts to set up security options like root password and remove test databases.- Start MySQL Service:
- Verify Installation: - Access the MySQL shell:
sudo systemctl start mysql
mysql -u root -p
Using Docker:
- Pull MySQL Docker Image:
- Run MySQL Container:
- Verify Installation: Connect to your running container:
docker pull mysql
docker run --name=mysql-container -e MYSQL_ROOT_PASSWORD=YourStrong!Passw0rd -d mysql
- Replace `YourStrong!Passw0rd` with a strong password.
docker exec -it mysql-container mysql -u root -p
After installing MySQL on your preferred operating system, you can start practicing by creating databases, tables, and executing queries using either command-line tools or graphical interfaces like MySQL Workbench or phpMyAdmin.
Any major changes in installation method or release of major version of software's will be reported and links will be updated to latest available versions.