Online SQL Editor

Available tables.

Chart for Data Science

  • for SQLite: NEW migrating to sqlite.org/wasm (from sql.js) UPD no 4mb query limit ADD regexp function ADD tooltip description for multi query UPD 1001 micro-modifications 04.2024
  • new concept ...2024
  • Concept generation 2 2023
  • ADD Format number in table 11.2023
  • UPD Multi share-connect UPD 1001 micro-modifications 9.2023
  • NEW Auto-save TAB 3.2023
  • NEW Clipboard to SQL ADD share-connect: simple link and password ADD SQLite enabled bigint UPD 1001 micro-modifications 2.2023
  • NEW Color settings ADD color theme "Dark" ADD color theme "Night" 11.2022
  • NEW SQLite server, share connect-link ADD show result from history ADD copy result from history UPD share link for: MariaDB, PostgreSQL, MS SQL 10.2022
  • New design Editor/Table four position Native scroll for table History saves the last 10 results 9.2022
  • FIX iOS height FIX iOS ContextMenu ADD Copy all table 4.2022
  • UPD MariaDB server UPD PostgreSQL server UPD MS SQL server ADD info from Oracle 12.2021
  • FIX left menu for mobile FIX left menu scroll 10.2021
  • UPD left menu, ADD multi >- DEL Share sqlite DB ADD Share cloud script UPD 1001 micro-modifications Remove lib MetisMenu 8.2021
  • ADD select query(text) RUN. 7.2021
  • FIX xss injections, Thanks Luis Madero https://twitter.com/_Y000_ 5.2021
  • Docker - SOE Mysql (0.0.6), Docker - SOE MariaDB (0.0.6): UPD Multi-Level Security block UPD Use memory ADD Time query Docker - SQLite Server (0.0.6-3.35.4): UPD Multi-Level Security block 4.2021
  • ADD Docker - SQLite Server ADD Time query (only "soe 0.0.4+" - Docker version) UPD Import UPD 1001 micro-modifications 3.2021
  • ADD Sort left menu ADD Search in left menu (Table, Column, Type, Index, Trigger, Procedure, Function, ..) Example: NameSearch #TypeSearch NameSearch#TypeSearch 1.2021
  • ADD Docker - PostgreSQL ADD Docker - MySQL ADD Docker - MariaDB 12.2020
  • UPD SQL.js ADD JSON1 (SQL.js) ADD FTS5 (SQL.js) 11.2020
  • ADD Import: MariaDB, PostgrSQL, MS SQL UPD Intelligent-Import UPD Cloud User Script 10.2020
  • ADD Hover cell ADD SQLite 3.33.0 UPD Stealth size bar in block UPD Left-Menu UPD Export UPD Import FIX Multi-PK 8.2020
  • FIX Visual-UPDATE ADD SQLite 3.32.1 ADD Save columns size 5.2020
  • ADD Multi-result ADD Short CODE: ct sf tableName ii tableName us tableName uw tableName df tableName dw tableName 4.2020
  • ADD Visual Sort column ADD Team-Work MariaDB ADD Team-Work MS SQL Server UPD MultiSyntax SQL 3.2020
  • NEW 1001+ UX ADD New Chart ADD Team-Work PostgreSQL Remove jQuery and all lib use 2.2020
  • ADD MS SQL Server - test ADD Oracle - test ADD NEW Scroll ADD Resize box ADD PostgreSQL - Export ADD MariaDB - Export ADD PostgreSQL - test ADD Visual-Edit MariaDB ADD Visual-Edit PostgreSQL 10.2019
  • ADD MariaDB - test UPD Visual DROP COLUMN + Syntax SQL UPD WASM default UPD Left menu ADD Visual DROP COLUMN + Syntax SQL UPD MultiVersion to WASM UPD Visual ADD COLUMN 07.2019
  • ADD Visual ADD COLUMN + Syntax SQL FIX Visual RENAME UPD Import SQL UPD Export CSV FIX db-save name ADD date release ADD Visual RENAME + Syntax SQL UPD Left menu UPD Import CSV FIX Export Schema UPD Code editor UPD AI.Help 6.2019
  • UPD Left menu sql schema FIX Visual TEST SQLite.wasm ADD Visual UPDATE + Syntax SQL ADD Visual DELETE + Syntax SQL UPD Visual INSERT + Syntax SQL 5.2019
  • UPD Default 3.28.0 FIX display text ADD Chart.test 4.2019
  • FIX Edge UPD Default 3.27.2 UPD 1001 micro-modifications ADD Geo-Balancing UPD Export JSON ADD Menu table - Export JSON 2.2019
  • UPD module library ADD Dark style ADD Test Premium 1.2019
  • ADD Scroll columns ADD Width column ADD auto-Width columns ADD Visual adding of ROW (INT, TEXT, BLOB) UPD Default 3.26.0 12.2018
  • ADD MultiVersion + 3.25.3 FIX Import CSV UPD Default 3.25.2 11.2018
  • ADD MultiVersion + 3.25.2 ADD MultiVersion + 3.25.0, 3.25.1 9.2018
  • FIX "table already exists" ADD MultiVersion many changes 8.2018
  • UPD Sqlite 3.24.0 6.2018
  • UPD Sqlite 3.23.1 ADD table setting col ADD "Open row" ai.link ADD "Open row" ai.color FIX back 5.2018
  • ADD "Open row" ai.image 4.2018
  • First version 2014

default 3.45.2 3.45.1 3.45.0 3.44.2 3.44.0 3.43.2 3.43.1 3.43.0 3.41.0 3.40.0 3.39.4 3.39.3 3.39.2 3.37.0 3.36.0 3.35.5 3.35.4 3.35.2 3.35.0 3.34.1 3.34.0 3.33.0.j 3.33.0 3.32.3 3.32.2 3.32.1 3.31.1 3.31.0 3.30.1 3.30.0 3.29.0 3.28.0 3.37.0 3.36.0 3.35.5 3.35.4 3.35.2 3.34.1 3.34.0 3.33.0.j 3.31.1 3.31.0 3.30.1 3.30.0 3.29.0 3.28.0

  • Disable BIGInt
  • AutoSET: PRAGMA foreign_keys = ON (for new db, current session only)
  • Left Menu DBlClick - SELECT Table
  • Editor Disable autocomplite
  • Disable the message about changes when the site is closed. (will work after the next load)

Silver Purplish Mil Antique Brass Blue Steel Indigo Tangerine Pink Frost Dark Night User color

Color settings

Hover cell None Animation Rectangle

Format number None Left Right L_ _R

MS SQL Server Express

Font-awesome.

Online SQL Editor

Run your SQL code using myCompiler's online IDE.

Fiddle with your code snippets easily and run them.

Start writing code instantly without having to download or install anything.

write query online

Run your SQL code without installing anything

Using myCompiler, you can run your code instantly from any device. Just visit our website, select a language, type in your code and hit "Run!" Write your code without having to spend hours figuring out how to set up a programming environment.

write query online

Feature-rich code editor

myCompiler's editor supports autocomplete and syntax highlighting out of the box, which makes writing code a breeze.

write query online

Multi-language support

Write programs in your favorite language, or start learning a new language. myCompiler supports 27 languages with more to come.

write query online

Organize and search your code

Organize your programs with tags and use the search bar to find them later on.

SandboxSQL is a online SQL editor and compiler where you can write and execute SQLite queries online. You can use the template databases to learn, practice, or test queries. Start by creating a new database or loading an existing one.

Ask questions in plain English , get SQL answers.

Generate database queries from natural language

Spend more time on data , less time on SQL

Works with your database.

We use a fine-tuned model to generate SQL queries from plain English. These queries are tailored to your database based on computed embeddings from user-provided descriptions of the database structure. Post-processing checks for correctness and flags possible issues.

By default, we do not store any of your data. Your database structure is fed to the model in order to generate query output.

Database information is stored in your browser and is not saved on our server, unless you explicitly save it using the Save or Share functionality. You can delete your information at any time.

The best way to find out is to try it yourself . We're constantly improving things, so results will get better over time. You'll also become more productive with this tool as you adopt the best practices and get used to its quirks.

QueryMuse is an assistant. You should always proofread and understand any a generated query before running it.

The more information you provide about your database, the better the results will be. You can fill out information about your database on the Databases page. Use the column details field to provide as much context on each column as possible.

During Phase 1, only users who are logged in can access the AI chat feature.

SQL Fiddle is free to use and ad-free!

Want to help us? It takes 10 seconds

Step 1 : Like & Share our EFE Bulk Extensions videos

Step 2 : Like & Share our EFE Bulk Insert videos

During Phase 1, only users who are logged in can access the AI Editor feature.

Under Development!

Fiddle History is not yet available.

We hope to make this feature available in May 2024.

  • Oracle PLSQL

Online SQLite Compiler

Welcome to our Online SQLite Compiler. Use our SQLite editor to write and edit any SQL query.

Once ready, click on "Execute" to let our compiler execute it and return the result in the output section.

Since we are in 2024, we also thought it was a great idea to super-charge our SQLite editor with AI tools.

Feel free to run and share your results with your colleagues, friends, on Stack Overflow, or anywhere else.

Online SQLite Chat

Our Online SQLite Chat, powered by ChatGPT, will help you by answering any of your SQLite related questions. To use the AI Chat:

  • Open the "Chat" on the sidebar.
  • Enter your question and click "Send."
  • Wait until the answer is fully generated.
  • Continue to chat with ChatGPT until your question is fully answered.

You can also use the quick action buttons to continue the discussion or right-click on any text to open the context menu with additional actions you can perform on the selected text.

Online SQLite Code Editor

Our Online SQLite Code Editor uses AI to edit any SQLite code you want to change. To have the SQL code edited:

  • Select the SQL code you want to edit.
  • Right-click to open the context menu.
  • Click on "Edit SQL." The AI Code Editor will appear on the sidebar with your code selected.
  • Enter your requirement and click "Generate."
  • Click on "Replace" to use the generated code or "Reset" to edit the original code again.

Online SQLite Explainer

Our Online SQLite Explainer uses AI to help you understand SQLite syntax or a part of the SQL query. To have the SQL explained:

  • Select the SQL code you want to be explained.
  • Click on "Explain SQL" or "Explain ELI5 SQL".

The Chat on the sidebar will open and start explaining what the selected SQL does. Feel free to ask any additional questions about the selected SQL if you need additional information.

Online SQLite Generator

Our Online SQLite Generator uses AI to generate any kind of SQL corresponding to your requirement. To have the SQL generated:

  • Open the "Code Editor" on the sidebar.
  • Repeat until you are satisfied with the code generated.
  • Click anywhere in the SQL Editor and click "Insert."

You can also simply copy the generated code and paste it wherever you need it in the SQL Editor.

Online SQLite Format / Beautifier

Our online SQLite formatter uses AI to make your code beautiful in a few clicks. To have the SQL formatted:

  • Select the SQL code you want to be formatted.
  • Click on "Format SQL".
  • Click on "Replace" if you want the formatted code to replace the original code.

Online SQLite For Practice

Our Online SQLite Compiler can be used for any kind of situation. It can be used for school, for work, or even just for fun:

  • You can use it to practise and improve your SQLite skills.
  • You can use it as an online SQLite training tool for students and teachers.
  • You can use it as an online tool for SQLite exercises and interview preparation.
  • You can use it as a personal SQLite sandbox and playground.

There is an unlimited amount of scenarios that you can use our SQLite compiler to practise your SQL.

Thank You for Sharing

This website is offered ad-free

Thanks to support from ZZZ Projects and Entity Framework Bulk Extensions .

Keep in mind, every time you click on "Execute," a new unique URL is created.

Copy and share your unique URL.

Login is required

write query online

write query online

SQL QUERY BUILDER – BUILD SQL QUERIES IN SECONDS WITHOUT ANY SQL KNOWLEDGE

  • Run your own SQL queries using our easy-to-use and intuitive drag-and-drop interface
  • Create charts, tables and dashboards with only a few clicks
  • Connect datapine to your database in less than 5 minutes

write query online

DATAPINE – THE ONLINE SQL QUERY BUILDER

Let our online sql query builder build sql queries for you.

An online SQL query builder is a cloud-based tool that helps businesses quickly build SQL queries without the need for any coding knowledge. By using an intuitive drag-and-drop interface, users can generate and visualize advanced SQL queries within seconds.

datapine offers an easy SQL query builder that enables you to build complex queries without any programming knowledge on the go. Building SQL queries has never been easier than with datapine’s simple, but powerful web-based tool. We support all common SQL databases including MySQL, Oracle, PostgreSQL, and MS SQL Server, among others.

These days, the most common type of database is still a relational database. Relational databases consist of multiple objects called tables which have relationships, or links, between them. The data or information for the database are stored in these tables. Once all of the data is inserted into tables, the user can write queries to look at and analyze the data, glean insights, and make critical business decisions. Once upon a time, this required a vast understanding of coding. However, datapine’s online SQL query builder enables anyone to build complex queries without any programming knowledge, empowering your entire business with the power of data analysis. Some of the key benefits you can gain from using an online query builder include:

Relief the IT department: In today’s fast-paced business world, analysts, marketers, and sales folks work hand-in-hand with the IT department. Instead of working behind the scenes, the IT department is now a strategic partner that is crucial to developing and executing business strategies. We used to rely on IT for mundane tasks like extracting data, cleaning it, and even building the reports. But now, new SQL reporting tools enable business folks to extract and analyze data themselves, freeing up valuable IT time and empowering non-IT staff to harness the power of their data. Cloud environment: With remote work being a permanent practice in the business industry the need for cloud-based tools has grown. Our SQL query generator is a SaaS solution that works completely online. There is no need to spend money and time on lengthy installations that take days to be completed. datapine takes only a few minutes to set up, all you need to do is run the tool in a browser with an internet connection, log into your account, and you will have full access to all features. You can forget about complicated updates and extra fees, as datapine’s SQL editor updates automatically. Accessibility & collaboration: Essentially, one of the main benefits you can gain from investing in an online SQL query builder is empowering non-technical users to rely on data for their decision-making process. Modern SQL solutions are self-service which means they are easy to use and manage, making them more approachable and accessible for anyone without the need for weeks or months of training. By giving every department the power to manage their information, a collaborative data-driven culture will be set in your entire organization. Take your data one step further: Modern solutions enable you to write SQL queries online with just a few clicks. But not just that, they help you take your data analysis process one step further by providing you with a wide range of innovative functions including interactive data visualizations, automated SQL queries, AI-based technologies, and much more. Like this, you will be able to extract the maximum potential out of your data without spending an insane amount of money and resources on manual tasks. More in these features on the next section of this post!

When building our product, we conducted user surveys and found that the average wait time from query request to actually receiving the data was between one and three business days. In today’s fast-moving business environment this is unacceptable. With our state of the art SQL query builder you can extract the data you need in real-time, with no coding knowledge required.

write query online

Become a data wizard in less than 1 hour!

write query online

DRAG AND DROP WITH OUR SQL QUERY BUILDER ONLINE

The core of our product is a powerful, easy-to-use visual SQL query builder online solution that removes the need for technical coding expertise. To start, we show you the visualized structure of your database. Based on that, we provide you with a smart drag-and-drop interface so you can quickly build your very own charts and tables. Within fractions of a second, we translate your actions into SQL code, send it to your database and the results are visualized in real-time. We designed the interface of our online data analysis tool together with several renowned companies, to make sure that it is easy enough for an intern, but smart enough for a PhD.

The value of an online SQL query builder is being able to perform the entire analysis process in one single solution. Not only that, but you can also run SQL queries from different data sources, all while experiencing unparalleled flexibility. Our software enables you to:

Connect your data: Data integration has never been easier thanks to professional data connectors that let you visualize all your internal and external data sources into one single point of access. With just a few clicks, connect all your SQL databases such as MySQL, PostgreSQL, Oracle, MS SQL Server, Google Cloud SQL but also AWS aurora, Heroku, Maria DB, Microsoft Azure, Percona, and Amazon Redshift, among others. Once your sources are connected, you are all set to start performing crossed analyses between various sources that will always have the latest information available for you. Embrace Automation: On the basis of making SQL query building a more user-friendly task, datapine automates queries so you don’t need to worry about manually handling your datasets as this is a time-consuming task that is also prompt to human error. Once your sources are connected, our online SQL query generator will build the required SQL queries for each of your databases. Drag & drop interface: Dealing with SQL queries has never been easier thanks to a drag and drop interface that enables anyone in your organization to query and visualize data without writing a single line of code. Simply drag and drop the desired data fields into the y and x axis and visualize your data in seconds. SQL box: While a drag & drop interface helps non-technical users to deal with SQL query building, the SQL box enables advanced users to write their own queries with more flexibility. You can manually enter code, perform cross-database queries, and modify your data series on the fly. Work From Anywhere: As mentioned, the cloud nature of an SQL generator online solution enables you to access your data from anywhere at any time. Having 24/7 access to your data gives you full control and flexibility. With datapine, you can write SQL queries online from your laptop, your phone, your tablet, or a desktop, as long as it has a browser and Internet access. Data visualizations: Being able to visualize all your SQL queries in a matter of seconds with interactive graphs and charts is another prime feature of us. datapine includes a professional dashboard creator with 25+ charting options so you can visualize your most relevant KPIs and join them together in an interactive dashboard. Displaying your data in a visually appealing way will make your information easier to understand and thus more efficient to work with.

datapine’s online SQL query builder not only saves your company plenty of time and resources but also significantly improves efficiency. Our survey showed that an average of 10 percent of IT resources is dedicated to extracting data, running queries, and analyzing data. Therefore, by applying our software, you can save a considerable part of your IT costs.

  • Online Data Analysis
  • SQL Report Generator
  • Excel Dashboard Software
  • Sales Reporting Tools
  • Web Based SQL Query Tool

ONE POWERFUL ONLINE SQL QUERY GENERATOR FOR ALL BUSINESS DEPARTMENTS

Sorting and arranging data in a meaningful way used to present a challenge. Whether you need to do a simple sort or a more challenging task of sorting, grouping, and summarizing data, datapine has you covered. What exactly does this look like? Let’s say that you want to look at how many customers your company is serving per country. You can simply drag the data you are interested in analyzing into either the x or y axis. You can then drill down even further, for instance by marketing channel. You can go even further by using filters. For instance, you can look at customers by channel, and use the filter options to select only women from a specific location (like a city). All the data you need is generated in seconds and you can choose between many different data visualizations to display the data in the most meaningful way.

Until now, management, controlling, and business development departments have traditionally not been able to extract and analyze the data in the example above by themselves using common software solutions. With our smart SQL online query builder, designed for non-technical people, you can build complex queries yourself and see the results in an instant.

Connect your database in less than ten minutes and instantly start running SQL Queries. After just a few steps, you can begin analyzing your data and create your first reports. Get a deep understanding of your individual department metrics by building your own KPI dashboard . All you have to do is to sign up for a free trial and then begin testing with a sample database, or even connect your own. Take a look at all the benefits of our online SQL query builder tool and get your 14-day free trial today.

write query online

SQLFormat is a free online formatter for SQL statements. Enter your SQL statement in the textarea below and click "Format SQL" [Ctrl+Enter]. To upload a file use the button right below the textarea.

In addition to this web interface SQLFormat provides an API . Or you can download the Python module that powers this service to use it in your own applications. See source code for details.

Switched to HTTPS

Both the frontend and the API are now available via HTTPS. Please update your bookmarks. More news...

Basic SQL Query Practice Online: 20 Exercises for Beginners

Author's photo

  • sql practice

Table of Contents

Exercise #1: Show the Final Dates of All Events and the Wind Points

Exercise #2: show all finals where the wind was above .5 points, exercise #3: show all data for all marathons, exercise #4: show all final results for non-placing runners, exercise #5: show all the result data for non-starting runners, exercise #6: show names for men’s discipline runs under 500 meters, exercise #7: sort country names and abbreviations, exercise #8: sort athletes’ first and last names, exercise #9: sort final results over three hours, exercise #10: show top 3 athletes’ names and places, exercise #11: show all marathons with their competition name, competition year, and discipline name, exercise #12: show mo farah’s scores for all disciplines, exercise #13: show the competitions’ names and the number of events, exercise #14: show the most popular athlete names, exercise #15: show each country and the number of athletes who finished without a place, exercise #16: calculate the average pace for each run, example #17: find all faster-than-average times for 1,500 meter runs, exercise #18: find all athletes who ran in at least two events in a competition, exercise #19: show runners who only finished first, exercise #20: find all the athletes who didn’t start and who won at least once, from basic sql query practice to becoming an sql master.

These 20 exercises are just what beginners need for SQL query practice. Try to solve each of them, and then look at the solutions. If something needs to be clarified, there are explanations for each solution.

In this article, there’ll be less talking than usual. Instead, you’re going to write the answers to SQL practice queries . (Don’t worry; we’ve included the solutions if you get stuck.) The whole point is to give you, as a beginner, plenty of opportunities for SQL query practice.

I’ve selected twenty examples from our Basic SQL Practice: Run Track Through Queries! . If you feel you need to practice more by the end of the article – I recommend that wholeheartedly! – you’ll find almost 100 more interactive SQL exercises in that course. They cover topics like querying one table, using JOINs , sorting data with ORDER BY , aggregating data and using GROUP BY , dealing with NULLs , doing mathematical operations, and writing subqueries.

These are all topics that any SQL beginner should know well before going on to the more complex topics. The best way to learn anything in SQL is to consistently write your own code. That way, you’ll master SQL syntax and its basic features; plus, you’ll understand problem-solving. After all, the whole point of knowing SQL is knowing how to use data to solve problems.

And you could go even further! We have the SQL Practice track and the Monthly SQL Practice course for yet more SQL query practice.

With that being said, let’s dive straight into the SQL practice, starting with the dataset.

SQL Query Practice

The dataset contains data about the finals of track running competitions across athletics championships: Rio de Janeiro Olympic Games in 2016, London IAAF World Championships in Athletics in 2017, and Doha IAAF World Championships in Athletics in 2019.

Data is stored in six tables: competition , event , discipline , final_result , athlete , and nationality . The schema is shown below:

Basic SQL Query Practice Online

The competition information is stored in the table competition . It has the following columns:

  • id – The ID of the competition and the primary key of the table.
  • name – The competition's name.
  • start_date – The competition's first day.
  • end_date – The competition's last day.
  • year – The year during which this competition occurred.
  • location – The location of this competition.

Here’s the data from the table.

The table discipline holds information for all running disciplines. It has these columns:

  • id – The ID of the discipline and the primary key of the table.
  • name – The discipline's name.
  • is_men – TRUE if it's a men's discipline, FALSE if it's a women's.
  • distance – The discipline's distance, in meters.

This is a snapshot of the first five rows of the data:

The next table is event , which stores  information about each particular event:

  • id – The ID of the event and the primary key of the table.
  • competition_id – Links the event to a competition.
  • discipline_id – Links the event to a discipline.
  • final_date – When this event's final was held.
  • wind – The wind points during the final.

Here are the first five rows of this table:

The data about each athlete is in the table athlete :

  • id – The ID of the athlete and the primary key of the table.
  • first_name – The athlete's first name.
  • last_name – The athlete's last name.
  • nationality_id – The athlete's nationality.
  • birth_date – The athlete's birth date.

These are the first five rows:

The nationality table contains country information:

  • id – The ID of the country and the primary key of the table.
  • country_name – The country's name.
  • country_abbr – The country's three-letter abbreviation.

Here is a five-row snapshot of this table:

The last table is final_result . It contains information about the participants and their results in a particular event:

  • event_id – The event ID.
  • athlete_id – The athlete’s
  • result – The time/score for the athlete (can be NULL).
  • place – The place achieved by the athlete (can be NULL).
  • is_dsq – TRUE if d i sq ualification occurred.
  • is_dnf – TRUE if the athlete d id n ot f inish the run.
  • is_dns – TRUE if the athlete d id n ot s tart the run.

Here’s the snapshot:

Now that you’ve had a good look at the dataset, let’s start our basic SQL query practice! All the exercises will require you to know some SQL, so make sure you know all the basic elements of an SQL query .

Exercise: Find the final dates of all events and the wind points.

Explanation: The data you need is in the table event . You have to select two columns from it: final_date and wind. You do that by writing the first column in the SELECT statement. Next, you write the second column name and separate the column names with a comma.

Finally, you reference the table in the FROM clause.

Exercise: Show all the finals’ dates with a wind stronger than 0.5 points.

Explanation: First, select the column final_date from the table event . With that, you’d get a list of all the finals. However, you don’t need the whole list – only those finals where the wind was stronger than 0.5.

So, you need to filter data using the WHERE clause. In it, you write the column name you want to filter; in this case, it’s the column wind . To get the wind above 0.5, use the ‘greater than’ ( > ) logical operator.

Exercise: Show the discipline data for all marathons.

Explanation: To select all the columns, you don’t have to write their names explicitly. There’s a shorthand for ‘all columns’ called asterisk ( * ). Instead of the columns’ names, just put an asterisk in SELECT .

Then, as you want data from the table discipline , you reference it in FROM .

Finally, you have to filter the data. Use  WHERE and the LIKE operator . This operator looks through textual data in the column and returns all rows containing the text in the WHERE condition. In other words, the condition will look for the word ‘Marathon’. You must put the word in single quotes.

However, you don’t know the exact name of the discipline; you just know it has to contain that word. It can be anywhere in the discipline name: at the beginning, middle, or end. To look anywhere in the string , put the modulo ( % ) operator before and after the word you’re searching.

Exercise: Show all the data for final results for runners who did not place.

Explanation: You need all the columns, so use an asterisk in SELECT and reference the table final_result in FROM.

You need to show only those results where runners ended without a place. You will use WHERE this time, too, and filter on the column place . If a runner ends without a place, then the column place will be empty (i.e. NULL). You need the IS NULL operator after the column name to return all these rows.

Knowing what a NULL is in SQL  would be a good idea before using the IS NULL operator.

Exercise: Show all the results data for runners that didn’t start the run at all.

Explanation: Select all the columns from the table final_result using an asterisk and referencing the table in FROM .

Then, you want to use WHERE and filter the column by is_dns . If the runner didn’t start the race, this column will have the TRUE value. So, you need to use the IS TRUE operator after the column name.

Output: Here’s the whole output:

Exercise: Show only the men’s discipline names where the distance to be run is less than 500 meters.

Explanation: First, select the column name from the table discipline .

You again need to filter data – this time, by putting two conditions in WHERE .

The first condition is that it’s a male discipline. So, you have to filter the column is_men using the IS TRUE operator. Then you add the second condition: the values in the column distance have to be below 500. This condition uses the less than operator ( < ). Since both conditions have to be satisfied, separate the conditions using the AND operator.

Exercise: Show all the countries’ names and abbreviations. Sort the output alphabetically by country name.

Explanation: Select the country name and its abbreviation from the table nationality .

To sort the output, use the ORDER BY clause. You want to sort by country name, so write country_name in ORDER BY . The output should be sorted alphabetically, so use the keyword ASC (ascending) after the column name.

Output: Here are the first five rows of the output:

Exercise: Show every athlete’s first and last name. Sort the output descendingly by the athlete’s first name. If multiple athletes have the same name, show their surnames sorted descendingly.

Explanation: Select the first and last name from the table athlete .

Then, add the ORDER BY clause. First sort by the first name descendingly, adding DESC after the column name. The second sorting condition sorts by the last name, also descendingly. Again, write the column name and add DESC . The conditions have to be separated by a comma.

Exercise: For all final results, show the times that are at least three hours. Sort the rows by the result in descending order.

Explanation: Select the column result from the table final_result .

Then, use WHERE to find the results that are below three hours. You can use the ‘greater than or equal’ ( >= ) and INTERVAL operators.

The data in the result column is formatted as time. So, you need to use INTERVAL to get the specific part (interval) from that data. In this case, it’s three hours. Simply write ‘3 hours’ after INTERVAL .

Finally, sort the output descendingly by the result.

Exercise: For every athlete ever on the podium (i.e. finished in the top 3), show their last and first name and their place.

Explanation: In this exercise, you need to use data from two tables: athlete and final_result . So, let’s start the explanation from the FROM clause.

You reference the athlete table and give it an alias ‘a’, so you won’t need to write the table’s full name elsewhere in the query. To get data from another table, too, you need to join the tables. In this case, use JOIN , which will return only the matching rows from both tables. You do that by simply referencing the table final_result in JOIN and adding the ‘fin’ alias.

Next, you have to specify the joining condition using the keyword ON . The tables are joined on shared columns: id from athlete and athlete_id from final_result . You’re looking for rows where the values in these two columns are equal, so put an equal sign ( = ) between them. In front of each column name, put the table alias followed by a dot so the database knows which table that column is in.

Now that you have joined the tables, you can select the columns. In front of each column name, put the table alias for the same reason as explained earlier. Now, you have the athletes’ last and first names and their places.

As a last step, simply filter data using WHERE and the column place . You’re looking for podium finishes, so the values must be equal to or less than three. Use the ‘less than or equal’ ( <= ) operator.

This SQL query practice requires you to know SQL JOINs. If you’re still unsure how they work, look at these SQL JOINs practice questions before you go to other exercises.

Exercise: Show all marathons, the name (rename this column competition_name ) and year of the competition, and the name of the discipline (rename this column discipline_name ).

Explanation: This exercise shows how to join multiple tables. The principle is the same as with two tables. You just add more JOINs and the joining conditions.

In this case, you join the competition and event tables where e.competition_id equals the c.id column .

Then, you need to add the discipline table to the joining chain. Write JOIN again and reference the table discipline . Add the joining condition: the column discipline_id from the event has to be equal to the id column from the discipline table.

Now, select the required columns, remembering to put the table alias in front of each column. Alias competition_name and discipline_name using the keyword AS to give them the column names described in the instructions.

Finally, filter the results to show only marathon disciplines.

Exercise: Show Mo Farah's (athlete ID of 14189197) scores for all disciplines. Show NULL if he has never participated in a given discipline. Show all the male disciplines' names, dates, places, and results.

Explanation: Join the tables discipline and event on the columns discipline_id and id . You need to use LEFT JOIN . This type of join will return all the rows from the first (left) table and only the matching rows from the second (right) table. If there are no matching rows, the values will be NULL . This is ideal for this exercise, as you need to show all disciplines and use  NULLs if Mo Farah has never participated in the discipline.

The next join is also a LEFT JOIN . It joins the table event with the table final_result . The first joining condition here joins the tables on the columns event_id and id . You also need to include the second condition by adding the keyword AND . This second condition will only look for Mo Farah’s data, i.e., the athlete with the ID of 14189197.

As a last step, use WHERE to find only men’s disciplines.

Exercise: Show all the competitions’ names and the number of events for each competition.

Explanation: First, show the column name from the table competition and rename the column to competition_name .

Then, use the aggregate function COUNT(*) to count the number of events that were held. The COUNT() function with an asterisk will count all the rows from the output, including NULLs. For better readability, we alias the resulting column as events_held .

The tables we join are competition and event . Finally, to get the number of events per competition, you need to GROUP BY the competition name.

Exercise: Show the most popular athlete names. Names are popular if at least five athletes share them. Alongside the name, also show the number of athletes with that name. Sort the results so that the most popular names come first.

Explanation: First, select the first names and count them using COUNT(*) . Then, group by the first name of the athlete. Now you have all the names and their count.

But you need to show only those names with a count above five. You’ll achieve that by using the HAVING clause. It has the same use as WHERE, but HAVING is used for filtering aggregated data.

Finally, sort the output by the name count from the highest to the lowest. You can’t simply write the name_count column name in ORDER BY because sorting is done before aggregation; SQL won’t recognize the column name. Instead, copy COUNT(*) and sort descendingly.

This exercise shows a typical SQL problem that requires filtering data with an aggregate function .

Exercise: Show all countries with the number of their athletes that finished without a place. Show 0 if none. Sort the output in descending order by the number of athletes and by the country name ascendingly.

Explanation: You have to keep all rows from the nationality table, so you need to LEFT JOIN it with the athlete table. You do that where id equals nationality_id . Then, LEFT JOIN another table where id from the athlete table equals athlete_id from the final_result table.

Because you need all the nationality rows, you can’t use the IS NULL condition in WHERE . There’s a solution: move it to the ON clause, and you’ll get all the values where the place is NULL .

Now, you can select the column country_name . Also, use the COUNT() function on the athlete_id column to get the number of athletes who finished without a place. You can’t use COUNT(*) here because it would’ve counted f, and you need the count of concrete athletes.

To get the count value by country, group the output by country name.

Finally, sort the output by the number of athletes descendingly and by the country name ascendingly.

Exercise: Calculate the average pace for each run and show it in the column named average_pace .

Explanation: To get the average pace by run, you need to divide the result by the distance. This is what the above query does, but with two tweaks.

First, you need to multiply the distance by 1.0. You do that to convert the distance to a decimal number. Without that, the division might return a different result, as the result will be divided by the whole number. The second tweak is that you divide the distance by 1,000. By doing this, you’ll convert the distance from meters to kilometers.

Now that you have the calculation, give this column the alias average_pace .

The rest of the query is what you already saw in previous examples: you’re joining the table event with the table discipline and then with the table final_result .

Output: Here are the first five rows from the output:

Exercise: Output the times for all 1,500-meter runs. Show only times that are faster than the average time for that run.

Explanation: You need to know SQL subqueries to solve this exercise. Their basic definition is that they are queries within a main query. Let’s see how this works!

Select the result column from the table final_result . Then, JOIN the table with event and then with the discipline table.

After that, you have to set two conditions in WHERE . The first one selects only distances that are equal to 1,500.

The second one looks for data where the result is below the total average for 1,500-meter runs. To calculate the average, use a subquery in the following way.

In the parentheses after the comparison operator, write another SELECT statement ( i.e., a subquery). In it, use the AVG() aggregate function to calculate the average result. The rest of the query is the same as the main query; you’re joining the same tables and using the same filtering condition in WHERE .

Output: Here are the first few rows from the output:

Exercise: Output a list of athletes who ran in two or more events within any competition. Show only their first and last names.

Explanation: Start by selecting the first and the last name from the table athlete .

Then, use WHERE to set up a condition. We again use a subquery to return data we wanted to compare, this time with the column id. However, in the previous example, we used the ‘less than’ ( < ) operator because the subquery returned only one value. This time, we use the operator IN , which will go through all the values returned by the subquery and return those that satisfy the condition.

The condition is that the athletes compete in at least two events within a competition. To find those athletes, select the column athlete_id and join the tables event and final_result . Then, group the results by the competition and athlete IDs. This example shows you can group the output by the column that is not in SELECT . However, all the columns that appear in SELECT have to also appear in GROUP BY .

Finally, use HAVING to filter the data. Count the number of rows using COUNT(*) . That way, you’re counting how many times each athlete appears. Set the condition to return only those athletes with a count equal to or above two.

Output: Here’s the output snapshot.

Exercise: Show all runners who have never finished at any place other than first; place was never missing for them. Show three columns: id , first_name , and last_name .

Explanation: For this solution, you need to use the EXCEPT set operator. The set operators are used to return the values from two or more queries. EXCEPT returns all the unique records from the first query except those returned by the second query.

The first query in the solution looks for those athletes who finished first. To get these values, select the required columns from the table athlete . Then, join the table with the table final_result . After that, set the condition in WHERE to find only the first places.

Now, write the EXCEPT keyword and follow it with the second query.

The second query is almost the same as the first one. The only difference is two conditions in WHERE .

The first condition returns all the places that are not the first by using the ‘not equal’ ( != ) operator. The second condition looks for the non- NULL places, i.e., the place was never missing for that athlete. The conditions are connected using OR because one of those conditions has to be true; the athlete can’t finish below first place and also not finish at all.

Note that for set operators to work, there has to be the same number of columns of the same data type in both queries.

Exercise: Output the athletes who didn’t start at least one race and won at least one race. Show three columns: id , first_name , and last_name .

Explanation: This exercise uses another set operators. This time, it’s INTERSECT , which returns all the values that are the same in both queries.

The first query in the solution lists the athlete IDs and first and last names. The tables athlete and final_result are joined on the columns id and athlete_id from the tables.

The condition in WHERE looks for rows with TRUE as a value in the column is_dns , i.e., the column that shows whether the athlete started the race.

As in the previous example, write the set operator and then the second query.

The second query is the same as the first one, except for WHERE . The filtering condition will find the athletes who finished first.

Together, these two queries output the athletes that didn’t start the race at least once but also finished first at least once.

You have to start from somewhere. These 20 basic SQL query practices are ideal for building foundations before learning more advanced concepts.

You learned plenty as you practiced writing queries that used WHERE , ORDER BY , JOINs , GROUP BY , and HAVING . I also showed you several examples of dealing with NULLs, doing computations, writing subqueries, and using set operators. The queries in this article have been taken from our Basic SQL Practice: Run Track Through Queries! You’ll find more basic SQL exercises there. And if you want more practice, check out our SQL Practice track, which contains 9 SQL practice courses for beginners.

Add 20 basic SQL query examples and 10 beginner SQL practice exercises to the mix, and you’ll be equipped with an intermediate level of SQL proficiency.

You may also like

write query online

How Do You Write a SELECT Statement in SQL?

write query online

What Is a Foreign Key in SQL?

write query online

Enumerate and Explain All the Basic Elements of an SQL Query

Illustration showing banks of tall servers lit in blue

Published: May 31, 2024 Contributors: Tim Mucci

Structured query language (SQL) is a standardized, domain-specific programming language that excels at handling data relationships. It is used extensively for storing, manipulating and retrieving data in systems such as MySQL, SQL Server and Oracle.

When data needs to be retrieved from a database, SQL is used to make the request. SQL is used by database administrators, developers and data analysts for tasks such as data definition, access control, data sharing, writing data integration scripts and running analytical queries .

Key functions of SQL:

  • Data definition : Define the structure and organization of the stored data and the relationships among stored data items.
  • Data retrieval : Retrieve specific data items or a range of items easily.
  • Data manipulation : Add new data, remove or modify existing data.
  • Access control : Restrict a user's ability to retrieve, add and modify data, protecting stored data against unauthorized access.
  • Data sharing : Used to coordinate data sharing by concurrent users, helping to ensure that changes made by one user do not inadvertently delete or overwrite changes made by other users. 

SQL is a versatile tool in the modern tech stack, used for managing data storage and processing solutions for both front-end and back-end applications. It is employed in various domains, such as handling e-commerce inventories and processing online transactions to organizing vast amounts of healthcare data for analysis. 

Renowned for its data manipulation capabilities, rapid query processing and strong security features, SQL offers commonality and compatibility across different systems, scalability to handle growing data needs and benefits from being open source with robust community support.

It differs from other computer languages because SQL describes what the user wants the computer to do rather than how it should do it. Specifically, SQL is a declarative or descriptive language rather than a procedural one. For example, when users write a SQL query to fetch data, they don't need to outline the steps the database should take to gather that data; they describe what the result should look like.

In data science and machine learning , SQL is used to create databases that store large data sets needed for analysis. Tools such as Microsoft SQL Server and MongoDB are two choices for handling different types of databases, from relational to NoSQL .

KuppingerCole's Leadership Compass report offers an insightful guide to database and big data security solutions, helping clients find the best products through a comprehensive analysis.

Introduced in the 1970s and developed by IBM scientists Donald Chamberlin and Raymond Boyce, SQL originated from the concept of relational models and was initially called structured English query language (SEQUEL) before being shortened to SQL. It became commercially available in 1979 and has since become the global standard for relational database management systems (RDBMS).

SQL was standardized by the American National Standards Institute (ANSI) in 1986 and the International Organization for Standardization (ISO) in 1987. Despite being a standard, SQL has various dialects, such as T-SQL for MS SQL Server and PL/SQL for Oracle , which cater to specific system needs while maintaining compliance with the core ANSI standard commands like SELECT, UPDATE, DELETE, INSERT and WHERE.

SQL is essential in the data industry and is used by analysts, scientists and database developers. Its universality makes it a valuable skill in understanding other programming languages like Python and Java. Since its development in the 1970s, SQL has become the backbone of modern database systems.

SQL is used for storing, retrieving, managing and manipulating data within database management systems (DBMS). It supports transaction processing and analytics applications and integrates seamlessly with various programming languages, such as Java , allowing developers to build high-performance data processing applications for different business intelligence needs.

Basic operations include these SQL commands:

  • SELECT * FROM customers ; to retrieve all records from the 'customers' table.
  • INSERT INTO customers (name, email) VALUES ('John Doe', 'john@example.com') ; to add a new customer or UPDATE customers
  • SET email = 'newemail@example.com' WHERE name = 'John Doe' ; to update an email address.

SQL operations are conducted through commands written as statements. These statements are aggregated into programs that facilitate the addition, modification or retrieval of data from a database, which consists of rows and columns in tables. Each row holds a record and each column represents a related category of data. In addition to tables, other database objects include views (logical data representations), indexes (to speed up lookups) and reports (data subsets based on criteria).

SQL databases are designed to help ensure reliable transaction processing by adhering to ACID properties: Atomicity (all-or-nothing), Consistency (protects database integrity), Isolation (transactions do not interfere with each other) and Durability (helps ensure that changes from successful transactions persist even if the system fails).

Relational databases organize data by using these rows and columns to structure information, such as customer information and purchase details. These tables are linked through relationships, often by using a specific identifier or primary key to facilitate efficient data retrieval and management.

While standard SQL is widely used, specific dialects like T-SQL by Microsoft SQL Server and PL/SQL by Oracle offer extensions to enhance procedural programming capabilities. SQL is known for its create, read, update and delete functions and its nonprocedural nature makes it accessible even to those with limited programming experience, often making it an easy language for beginners. It adheres to ANSI standards and is available in free SQL software like MySQL, PostgreSQL and Microsoft SQL.

SQL allows for the organization of data in a tabular format with rows and columns, facilitating the establishment of relationships between different tables. For instance, a customer service database might use separate tables for customer information, purchases, product codes and contacts, linked by keys like a unique customer ID.

This linkage often involves relationships, such as one-to-many or many-to-many, established using primary and foreign keys to help ensure data integrity.

SQL handles operations such as data creation, reading, updating and deletion. For example, using the Join operation, SQL can link customer information with purchases based on customer ID to provide a comprehensive view.

SQL quickly processes and retrieves data, by using indexes and query optimization techniques to enhance performance.

SQL includes user authentication to protect data integrity and privacy, such as access controls and encryption.

SQL's adherence to standards like ANSI and ISO helps ensure widespread compatibility with various systems and platforms, including cloud environments and big data tools.

SQL can effectively manage both small and large databases, adapting to growing data needs without significant performance loss.

Many SQL variants are open source and supported by a large, active community that contributes to continuous improvement and problem-solving.

Despite these strengths, other enterprise applications are vulnerable to security issues, such as weak authentication, insecure design and misconfiguration. SQL injection remains a threat, where attackers manipulate SQL queries to access or corrupt database information. Understanding these vulnerabilities and implementing robust security measures is critical for safeguarding data.

An SQL table, the fundamental unit of a relational database, is organized into rows and columns to efficiently store and manage data. SQL enables the creation of relationships between tables, such as linking a PRODUCT table to a COLOR table through keys and optimizing data storage and retrieval.

SQL processes involve several components:

  • Parser : Verifies the correctness of SQL statements and converts them into a format that the database can understand. This involves syntax analysis and semantic checking to ensure that the user is authorized to operate.
  • Relational engine : Also known as the query optimizer, it plans the most efficient data retrieval, writing or updating strategies by evaluating different query execution plans. This step is crucial for optimizing performance and resource use.
  • Storage engine : Runs the SQL statement and manages physical data storage. It handles the physical representation of data, including file formats and data buffering, helping to ensure efficient data access and updates on disk.

SQL supports various statements for data operations. Here are the most common, with examples:

SELECT name, email FROM customers WHERE city = 'New York' ;

This statement retrieves the name and email of all customers who live in New York from the customers table.

INSERT INTO customers (name, email, city) VALUES ('Jane Doe', 'jane.doe@example.com', 'Los Angeles') ;

This statement adds a new row to the customers table with the name 'Jane Doe', email 'jane.doe@example.com' and city 'Los Angeles'.

UPDATE customers SET email = 'new.email@example.com' WHERE name = 'John Doe' ;

This statement updates the email of the customer named 'John Doe' in the customers table to 'new.email@example.com'.

DELETE FROM customers WHERE city = 'Boston' ;

This statement deletes all rows from the customers table where the city is 'Boston'.

CREATE TABLE products ( product_id INT PRIMARY KEY, name VARCHAR(100), price DECIMAL(10, 2) ) ;

This statement creates a new table called products with three columns: product_id as an integer primary key, name as a variable character string up to 100 characters and price as a decimal with ten digits and two decimal places.

ALTER TABLE customers ADD COLUMN birthday DATE ;

This statement adds a new column birthday of type DATE to the existing customers table.

DROP TABLE old_customers ;

This statement deletes the old_customers table along with all its data.

SELECT c.name, p.product_name FROM customers c JOIN orders o ON c.customer_id = o.customer_id JOIN products p ON o.product_id = p.product_id WHERE c.city = 'New York' ;

This statement retrieves the names of customers and the names of the products they ordered. It joins the customers, orders and products tables based on the customer_id and product_id, selecting only those customers who live in New York.

  • Data definition language (DDL) : Manages database objects like tables, views and indexes.
  • Data manipulation language (DML) : Manages data within databases through operations like INSERT, UPDATE and DELETE.
  • Data control language (DCL) : Controls data access through commands like GRANT and REVOKE, helping to ensure appropriate levels of access.
  • Data query language (DQL) : Executes data queries to retrieve information.
  • Transaction control language (TCL) : Manages transaction changes to help ensure data integrity and supports rollback and commit operations.

More components of an SQL system include constraints, stored procedures, transactions, data types, indexes, views, security and permissions. Indexes speed up data retrieval by reducing the number of disk accesses needed for a query.

Views act as virtual tables based on SQL queries to simplify complex queries and improve security by restricting access to underlying data. Security and permissions manage user access, while backup and recovery mechanisms protect data against loss or corruption.

MySQL is an open source RDBMS provided by Oracle, without charge for developers to use on various platforms, including cloud servers. It is popular in web applications due to its functions and adaptability. MySQL is a specific implementation that uses SQL queries and is regularly updated and improved by Oracle.

NoSQL databases emerged in the late 2000s to handle data with less structure, offering faster queries and more flexible data models compared to SQL databases. While SQL databases excel in managing relational data and helping to ensure structured, efficient data storage, NoSQL databases are known for their scalability and diverse data structures like graphs, documents or wide column stores.

Key differences include:

  • Scalability : NoSQL is horizontally scalable and manages higher traffic by adding more servers. In contrast, SQL is traditionally vertically scalable, requiring more powerful hardware to handle increased load.
  • Structure : SQL databases use a table-based structure ideal for multirow transactions and complex queries across related data, thanks to robust indexing and joining capabilities. NoSQL offers various structures, such as key-value, document, graph or wide column stores, catering to different needs and allowing for more flexibility with semistructured or unstructured data.
  • Performance characteristics : SQL databases are optimized for complex queries with strict data consistency, following the ACID principles. NoSQL databases, that use basically available, soft state, eventual consistency (BASE) principles, provide faster performance for specific types of data but with different consistency guarantees.
  • Use cases : SQL is often chosen for applications requiring complex transactions, consistent data and strict schema adherence, like financial systems or CRM databases. NoSQL is preferred for rapidly changing, large-scale or semistructured data, such as in social networks, real-time analytics or content management systems.
  • Knowledge and community : SQL has a more extensive range of resources and community support due to its longer history and commonality. The learning curve for SQL can be steeper due to the need to understand relational models and query optimization, but many tools and interfaces are available to simplify these tasks. NoSQL often requires less upfront design and can be easier to scale but might need more custom development for complex querying and data consistency.
  • Maintenance and management : SQL databases require careful schema design and can be demanding in terms of maintenance for schema changes. NoSQL databases offer easier scalability and adaptability for schema changes without extensive downtime or restructuring.

IBM Db2 offers robust performance, scalability and advanced analytics capabilities to help ensure efficient data management and insightful business intelligence.

A hybrid SQL-on-Hadoop engine delivering advanced, security-rich data queries across enterprise big data sources, object storage and data warehouses.

Discover how IBM’s managed PostgreSQL service offers robust scalability, advanced security and high availability, along with seamless integration into IBM Cloud, to optimize your database management and analytics capabilities.

Discover how integrating graph and blockchain data within SQL databases can enhance data accessibility, streamline query processes and unlock deeper insights for AI-driven business solutions.

Gain a comprehensive understanding of relational databases, their structure, advantages and how they facilitate data management and querying for business insights.

Understand the key differences between SQL and NoSQL databases and learn how to choose the right type of database for your specific data management needs and use cases.

Gain a single, cloud-native engine for database administrators, enterprise architects and developers to keep apps running, store and query anything, and simplify development. No matter the volume or complexity of transactions, protect your applications and make them highly performant and resilient anywhere.

SQL Tutorial

Sql database, sql references, sql examples.

SQL is a standard language for storing, manipulating and retrieving data in databases.

Our SQL tutorial will teach you how to use SQL in: MySQL, SQL Server, MS Access, Oracle, Sybase, Informix, Postgres, and other database systems.

Examples in Each Chapter

With our online SQL editor, you can edit the SQL statements, and click on a button to view the result.

Click on the "Try it Yourself" button to see how it works.

SQL Exercises

Test yourself with exercises.

Insert the missing statement to get all the columns from the Customers table.

Start the Exercise

Advertisement

Learn by examples! This tutorial supplements all explanations with clarifying examples.

See All SQL Examples

SQL Quiz Test

Test your SQL skills at W3Schools!

Start SQL Quiz!

My Learning

Track your progress with the free "My Learning" program here at W3Schools.

Log in to your account, and start earning points!

This is an optional feature. You can study at W3Schools without using My Learning.

write query online

At W3Schools you will find a complete reference for keywords and function:

SQL Keyword Reference

MYSQL Functions

SQLServer Functions

MS Access Functions

SQL Quick Reference

SQL Data Types

Data types and ranges for Microsoft Access, MySQL and SQL Server.

SQL Exam - Get Your Diploma!

Kickstart your career.

Get certified by completing the course

Get Certified

COLOR PICKER

colorpicker

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected]

Top Tutorials

Top references, top examples, get certified.

write query online

Import data from the web

Learn how to import data from any website and use table detection tools to quickly structure and model your data.

What is the web connector for Excel?

The web connector for Excel (AKA Get Data From Web ) is a powerful tool that allows you to connect to websites and import data into your Excel workbook. The Web connector leverages the strength of Power Query in Excel to import data. You can also refresh your data connection to get the latest updates from the selected websites.

Advanced features in the web connector for Excel

The web connector for Excel has new features and enhancements:

Suggested Tables: Provides auto-detection of tables and will suggest tables, so you can easily structure your data.

Add Table Using Examples : Allows you to provide examples of what you want your data to look like, and select from AI-generated table structures based on the examples provided.

Note: These tools are also available in Power BI .

How to get started

The new Web connector in Excel is available as part of an Office 365 subscription . If you are an Office 365 subscriber, find out how to get the latest updates . You also need to have an internet connection to access the web data sources.

The following sections describe how to connect to a website, select data, and bring that data into Excel – using the new features:

To use the Web connector for Excel, follow these steps:

Open Excel and create a new workbook or open an existing one.

Go to the Data tab and click on From Web (or Get Data > From Other Sources > From Web)

Enter URL

Alternatively, you can use the new Add Table Using Examples feature, which presents an interactive window, where you can preview the content of the Web page. Enter sample values of the data you want to extract.

Add Table Using Examples

You can use Transform Data to shape your data with the Power Query Editor, or Load to load the data to the Excel grid. For more information about Power Query in Excel, see Power Query for Excel Help .

Power Query for Excel Help

Import data from data sources (Power Query)

Web Power Query Connector

Facebook

Need more help?

Want more options.

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

write query online

Microsoft 365 subscription benefits

write query online

Microsoft 365 training

write query online

Microsoft security

write query online

Accessibility center

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

write query online

Ask the Microsoft Community

write query online

Microsoft Tech Community

write query online

Windows Insiders

Microsoft 365 Insiders

Was this information helpful?

Thank you for your feedback.

PostgreSQL online editor

Write, Run & Share PostgreSQL queries online using OneCompiler's PostgreSQL online editor and compiler for free. It's one of the robust, feature-rich online editor and compiler for PostgreSQL. Getting started with the OneCompiler's PostgreSQL editor is really simple and pretty fast. The editor shows sample boilerplate code when you choose database as 'PostgreSQL' and start writing queries to learn and test online without worrying about tedious process of installation.

About PostgreSQL

PostgreSQL is a open source relational database system and is also knows as Postgres.

Key Features:

  • Postgres is not only free and open-source but also it is highly extensible.
  • Custom Data types and funtions from various programming languaues can be introduced and the good part is compiling entire database is not required.
  • ACID(Atomicity, Consistency, Isolation, Durability) compliant.
  • First DBMS which implemented Multi-version concurrency control (MVCC) feature.
  • It's the default database server for MacOS.
  • It supports all major operating systems like Linux, Windows, OpenBSD,FreeBSD etc.

Syntax help

CREATE command is used to create a table, schema or an index.

ALTER command is used to add, modify or delete columns or constraints from the database table.

3. TRUNCATE:

TRUNCATE command is used to delete the data present in the table but this will not delete the table.

DROP command is used to delete the table along with its data.

RENAME command is used to rename the table name.

INSERT Statement is used to insert new records into the database table.

Select statement is used to select data from database tables.

UPDATE statement is used to modify the existing values of records present in the database table.

DELETE statement is used to delete the existing records present in the database table.

Purdue Online Writing Lab Purdue OWL® College of Liberal Arts

Welcome to the Purdue Online Writing Lab

OWL logo

Welcome to the Purdue OWL

This page is brought to you by the OWL at Purdue University. When printing this page, you must include the entire legal notice.

Copyright ©1995-2018 by The Writing Lab & The OWL at Purdue and Purdue University. All rights reserved. This material may not be published, reproduced, broadcast, rewritten, or redistributed without permission. Use of this site constitutes acceptance of our terms and conditions of fair use.

The Online Writing Lab at Purdue University houses writing resources and instructional material, and we provide these as a free service of the Writing Lab at Purdue. Students, members of the community, and users worldwide will find information to assist with many writing projects. Teachers and trainers may use this material for in-class and out-of-class instruction.

The Purdue On-Campus Writing Lab and Purdue Online Writing Lab assist clients in their development as writers—no matter what their skill level—with on-campus consultations, online participation, and community engagement. The Purdue Writing Lab serves the Purdue, West Lafayette, campus and coordinates with local literacy initiatives. The Purdue OWL offers global support through online reference materials and services.

A Message From the Assistant Director of Content Development 

The Purdue OWL® is committed to supporting  students, instructors, and writers by offering a wide range of resources that are developed and revised with them in mind. To do this, the OWL team is always exploring possibilties for a better design, allowing accessibility and user experience to guide our process. As the OWL undergoes some changes, we welcome your feedback and suggestions by email at any time.

Please don't hesitate to contact us via our contact page  if you have any questions or comments.

All the best,

Social Media

Facebook twitter.

COMMENTS

  1. SQL Fiddle

    Features and Benefits. SQL Fiddle offers a range of features designed to enhance your SQL learning and development experience: Multiple Database Support: Practice with different SQL language to improve your knowledge.; Real-time Code Execution: Test your SQL queries instantly and see the results in real time.; Collaboration: Share your SQL fiddles with others, making it easier to collaborate ...

  2. Online SQL Editor

    Online SQL Editor. Run SQL. x. -- Online SQL Editor to Run SQL Online. -- Use the editor to create new tables, insert data and all other SQL operations. SELECT first_name, age. FROM Customers;

  3. SQL Online Compiler

    SQL OnLine - Next gen SQL Editor: SQLite, MariaDB / MySQL, PostgreSQL, MS SQL Server. User-friendly interface for data science. No registration for start, No DownLoad, No Install. Online test SQL script. Online Open/Save SQLite file. Online view all table DB. Fiddle link SQL text and DB file. SQL Test, SQLite in Browser, Data for World, online sql compiler,free db,free database,db free ...

  4. SQL Online Editor (Compiler)

    W3Schools Spaces is a website-building tool that enables you to create and share your website. In addition to a server, you get a SQL Database where you can store and access your data. It's easy to use and doesn't require any setup. The code editor is packed with features to help you achieve more: Templates: Start from scratch or use a template.

  5. MySQL Online Editor

    Write, Run & Share MySQL queries online using OneCompiler's MySQL online editor and compiler for free. It's one of the robust, feature-rich online editor and compiler for MySQL. Getting started with the OneCompiler's MySQL editor is really simple and pretty fast. The editor shows sample boilerplate code when you choose language as 'MySQL' and ...

  6. SQL Server Online Editor & Compiler

    STDIN. STDIN. Output: Click on RUN button to see the output. OneCompiler's SQL Server online editor helps you to write, debug, run and test SQL Server code/ queries online.

  7. Online SQL Editor

    Online SQL Editor - Edit and Run your SQL scripts with myCompiler. Simple and easy to use IDE to edit, run and test your SQL code. ... select a language, type in your code and hit "Run!" Write your code without having to spend hours figuring out how to set up a programming environment. Feature-rich code editor myCompiler's editor supports ...

  8. Oracle Online Editor

    Write, Run & Share Oracle queries online using OneCompiler's Oracle online editor and compiler for free. It's one of the robust, feature-rich online editor and compiler for Oracle running on latest version 23c (23.3.0.0). Getting started with the OneCompiler's Oracle editor is really simple and pretty fast. The editor shows sample boilerplate ...

  9. SQL Online Compiler

    Harness the power of SQL with NextLeap's SQL Online Compiler. Write, test, and execute SQL queries online in real time. Dive into database management and SQL programming with ease.

  10. The Best Online SQL Editors

    Oracle Live SQL is an online platform designed for working with Oracle Database. It allows users to write, run, and share SQL queries and scripts. Its interface is user-friendly and designed to be accessible, especially for those new to Oracle Database. The platform is intuitive, with easy navigation through its features and resources.

  11. QuerySandbox

    QuerySandbox is an online sandbox environment to quickly write, run and analyze SQL queries. ... QuerySandbox is an online sandbox environment to quickly write, run and analyze SQL queries. CtrlK. File. Run. Insert. Help. Clear. Format. Run. Query. Query output. Query analysis. No database loaded. Open and load a database using ...

  12. Sandbox SQL

    Welcome! SandboxSQL is a online SQL editor and compiler where you can write and execute SQLite queries online. You can use the template databases to learn, practice, or test queries. Start by creating a new database or loading an existing one. Learn and play around with SQL!

  13. SQL query writer

    Write SQL queries in seconds with AI assistance. 1. Add your database. 2. Generate queries. Use natural language to describe what you want to query. We'll generate SQL using a fine-tuned model. 3. Share with colleagues.

  14. DB Fiddle

    An online SQL database playground for testing, debugging and sharing SQL snippets. An online SQL database playground for testing, debugging and sharing SQL snippets. 3. Database: MySQL v5.7. Run Save Load Example ... Query SQL xxxxxxxxxx. 1 . 1 ...

  15. FREE AI-Enhanced Online SQLite Compiler

    Online SQLite Compiler. Welcome to our Online SQLite Compiler. Use our SQLite editor to write and edit any SQL query. Once ready, click on "Execute" to let our compiler execute it and return the result in the output section. Since we are in 2024, we also thought it was a great idea to super-charge our SQLite editor with AI tools.

  16. JDoodle

    JDoodle is an Online Compiler, Editor, IDE for Java, C, C++, PHP, Perl, Python, Ruby and many more. You can run your programs on the fly online, and you can save and share them with others. Quick and Easy way to compile and run programs online.

  17. VisualSQL

    VisualSQL is a free online tool for efficient SQL query building. Build SQL queries visually and avoid the inconvenient side of SQL with VisualSQL.

  18. Learn SQL

    Practice SQL querys with an online terminal. Solve SQL query questions using a practice database. Learn and improve your SQL skills.

  19. SQLite Online Editor

    Write, Run & Share SQLite queries online using OneCompiler's SQLite online editor and compiler for free. It's one of the robust, feature-rich online editor and compiler for SQLite. Getting started with the OneCompiler's SQLite editor is really simple and pretty fast. The editor shows sample boilerplate code when you choose language as 'SQLite ...

  20. Online SQL Query Builder

    An online SQL query builder is a cloud-based tool that helps businesses quickly build SQL queries without the need for any coding knowledge. By using an intuitive drag-and-drop interface, users can generate and visualize advanced SQL queries within seconds. datapine offers an easy SQL query builder that enables you to build complex queries ...

  21. Format SQL Statements Online

    SQLFormat is a free online formatter for SQL statements. Enter your SQL statement in the textarea below and click "Format SQL" [Ctrl+Enter]. To upload a file use the button right below the textarea. In addition to this web interface SQLFormat provides an API. Or you can download the Python module that powers this service to use it in your own ...

  22. Basic SQL Query Practice Online: 20 Exercises for Beginners

    SQL Query Practice. Dataset. Exercise #1: Show the Final Dates of All Events and the Wind Points. Exercise #2: Show All Finals Where the Wind Was Above .5 Points. Exercise #3: Show All Data for All Marathons. Exercise #4: Show All Final Results for Non-Placing Runners. Exercise #5: Show All the Result Data for Non-Starting Runners.

  23. What is Structured Query Language

    Structured query language (SQL) is a standardized, domain-specific programming language that excels at handling data relationships. It is used extensively for storing, manipulating and retrieving data in systems such as MySQL, SQL Server and Oracle. When data needs to be retrieved from a database, SQL is used to make the request.

  24. SQL Tutorial

    SQL. Tutorial. SQL is a standard language for storing, manipulating and retrieving data in databases. Our SQL tutorial will teach you how to use SQL in: MySQL, SQL Server, MS Access, Oracle, Sybase, Informix, Postgres, and other database systems.

  25. Import data from the web

    To use the Web connector for Excel, follow these steps: Open Excel and create a new workbook or open an existing one. Go to the Data tab and click on From Web. (or Get Data > From Other Sources > From Web) Enter the URL of the Web page from which you'd like to extract data. In this article, we'll use the Microsoft Store Web page, and show how ...

  26. PostgreSQL Online Editor

    Write, Run & Share PostgreSQL queries online using OneCompiler's PostgreSQL online editor and compiler for free. It's one of the robust, feature-rich online editor and compiler for PostgreSQL. Getting started with the OneCompiler's PostgreSQL editor is really simple and pretty fast. The editor shows sample boilerplate code when you choose ...

  27. Welcome to the Purdue Online Writing Lab

    The Online Writing Lab at Purdue University houses writing resources and instructional material, and we provide these as a free service of the Writing Lab at Purdue. Students, members of the community, and users worldwide will find information to assist with many writing projects. Teachers and trainers may use this material for in-class and out ...

  28. Top Online Courses and Certifications

    5. 84. Find Courses and Certifications from top universities like Yale, Michigan, Stanford, and leading companies like Google and IBM. Join Coursera for free and transform your career with degrees, certificates, Specializations, & MOOCs in data science, computer science, business, and hundreds of other topics.

  29. Songwriting: Writing, Arranging, and Producing Music

    Write, Arrange, and Produce Your Original Songs. Apply the tools and techniques of songwriting to bring your musical ideas to life. Taught in English. 22 languages available. Some content may not be translated. Instructors: Erin Barra. +4 more. Enroll for Free.

  30. Asia Pacific Commemoration for World Environment Day 2024

    World Environment Day 2024 Join the #GenerationRestoration action in Bangkok on 5 June! World Environment Day is celebrated annually on 5 June to put a spotlight on environmental challenges of our time. World Environment Day 2024 focuses on land restoration, stopping desertification and building drought resilience. The Kingdom of Saudi Arabia is the global host of this year's edition. Asia and ...