Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Queries For Practice in SQL

Queries For Practice in SQL

Sure! Here are some practice SQL queries covering various important concepts, so you can sharpen your skills:


Sample Table: employees

employee_idfirst_namelast_namedepartmentsalaryhire_date
1JohnDoeSales500002019-01-15
2JaneSmithHR600002018-03-12
3AliceJohnsonSales550002020-07-08
4BobBrownIT700002017-10-20
5CarolDavisIT720002021-01-30

Practice Queries

1. Select all columns from employees

SELECT * FROM employees;

2. Select first and last names of employees in the Sales department

SELECT first_name, last_nameFROM employeesWHERE department = 'Sales';

3. Find employees with salary greater than 60000

SELECT *FROM employeesWHERE salary > 60000;

4. Count number of employees in each department

SELECT department, COUNT(*) AS employee_countFROM employeesGROUP BY department;

5. Find the highest salary in the company

SELECT MAX(salary) AS highest_salaryFROM employees;

6. List employees ordered by hire_date ascending

SELECT *FROM employeesORDER BY hire_date ASC;

7. Update salary of employee with employee_id = 3 to 58000

UPDATE employeesSET salary = 58000WHERE employee_id = 3;

8. Delete employee with employee_id = 5

DELETE FROM employeesWHERE employee_id = 5;

9. Insert a new employee record

INSERT INTO employees (employee_id, first_name, last_name, department, salary, hire_date)VALUES (6, 'Eve', 'Wilson', 'HR', 62000, '2023-05-15');

10. Find employees hired after January 1, 2019

SELECT *FROM employeesWHERE hire_date > '2019-01-01';

Bonus Advanced Queries:

  • Join employees with a departments table to get department names

  • Find average salary per department

  • Find employees whose names start with 'J'

  • Use LIKE to find employees with ‘son’ in last name


Would you like me to create sample data for you to try these queries? Or queries for any specific topic like JOINS, AGGREGATES, or SUBQUERIES?

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql