Skip
Arish's avatar

2. Executing SQL Queries


Running SQL Queries

You can execute SQL queries using keyboard shortcuts for faster workflow.

Common Shortcuts

ActionShortcut
Execute QueryCtrl + Enter or Cmd + Enter
Execute AllCtrl + Shift + Enter
New QueryCtrl + N
Save QueryCtrl + S

SQL Query Structure

A basic SQL query follows this pattern:

sql
1SELECT column1, column2
2FROM table_name
3WHERE condition;

Running Your First Query

sql
1-- Select all data from a table
2SELECT * FROM students;

Tips for Running Queries

  1. Always end with semicolon - SQL statements end with ;
  2. Test on small data - Use LIMIT to test queries
  3. Check syntax - SQL is case-insensitive but conventions help
  4. Read error messages - They guide you to the issue

Practice Environment

You can practice SQL using:

  • SQLite - Lightweight, file-based
  • MySQL - Popular open-source database
  • PostgreSQL - Advanced features
  • Online playgrounds - SQLFiddle, DB Fiddle