Skip to main content

Mastering MS Access: How to Create Tables and Write Custom SQL Queries

  Mastering MS Access: How to Create Tables and Write Custom SQL Queries Why I Still Use SQL in Microsoft Access When I first started working with databases, I realized that while MS Access has a "point-and-click" interface, it is much more powerful when you write the code yourself. In my latest project, I found that using raw SQL queries is faster and more reliable than the standard query builder. I’ve recorded a full video tutorial showing my process, but in this post, I want to break down the logic behind creating tables and the SQL syntax you need to know. You can watch the video tutorial here:   Step 1: Planning the Table Structure Before I touch the SQL view, I always define my table relationships. For this tutorial, we are using a Sales demo Database example. My Pro-Tip: Always use a Primary Key with the AutoNumber type. It prevents duplicate records and makes your SQL Joins much easier later on. Here is h ow to create a table.  Click on Create tab Click on Ta...

Mastering MS Access: How to Create Tables and Write Custom SQL Queries

 

Mastering MS Access: How to Create Tables and Write Custom SQL Queries

Why I Still Use SQL in Microsoft Access

When I first started working with databases, I realized that while MS Access has a "point-and-click" interface, it is much more powerful when you write the code yourself. In my latest project, I found that using raw SQL queries is faster and more reliable than the standard query builder.

I’ve recorded a full video tutorial showing my process, but in this post, I want to break down the logic behind creating tables and the SQL syntax you need to know.


You can watch the video tutorial here:  



Step 1: Planning the Table Structure

Before I touch the SQL view, I always define my table relationships. For this tutorial, we are using a Sales demo Database example.

My Pro-Tip: Always use a Primary Key with the AutoNumber type. It prevents duplicate records and makes your SQL Joins much easier later on.

Here is how to create a table. 

Click on Create tab


Click on Table icon

After we create a table, we will see Table1 automatically. Then, we can edit our table design.



Then, Right click on Table1 from Left Pane to add Field Name and Data Type.


Save the table with name "Demo" for example.



Then, we can add Field Name and Data Type here.




Enter the following Field Name and Data Types. Then, click on 'Save' button to save the data. 

  • ID: AutoNumber (Primary Key)

  • Product_Name: Short Text

  • Price: Currency

  • Stock_Level: Number



We can see our table when we double click on Table Name from the Left Pane (Demo). It is ready to enter the data into the table. 






Step 2: Writing the SQL Query

In the blog, I show how to switch from the "Design View" to the "SQL View." This is where the real magic happens.

If we want to find all products that are low on stock, we don't need to filter manually. We can use this specific SQL script I wrote:

If we want to write SQL query, Go to Create Tab, then, Click on SQL Query icon.




Example SQL query: 

/* Query to find low stock items */
SELECT
    Product_Name,
    Stock_Level
FROM
    Demo
WHERE
    Stock_Level > 10
ORDER BY
    Stock_Level ASC;


We can write our SQL query in this Query Design View. After we write the query, click save for the query.





Click on Run button to see the SQL result:



Why this works: The WHERE clause allows us to isolate specific data, and ORDER BY ensures the most urgent items (lowest stock) appear at the top of our report.


Step 3: Common SQL Mistakes in Access

While writing this tutorial blog, I ran into a few syntax errors that are unique to Access. Here is how I fixed them:

  1. Table Names with Spaces: If your table is named Product List, you must use square brackets: [Product List].

  2. Date Formatting: Access requires # symbols around dates (e.g., #01/01/2026#), unlike MySQL which uses quotes.

Final Thoughts

Learning to bridge the gap between a visual database and raw code is a huge step for any developer. If you have questions about the specific SQL commands I used in the video, please leave a comment below!

Comments

Popular posts from this blog

Build a Complete Full-Stack Web App with Vue.js, Node.js & MySQL – Step-by-Step Guide

📅 Published on: July 2, 2025 👨‍💻 By: Lae's TechBank  Ready to Become a Full-Stack Web Developer? Are you looking to take your web development skills to the next level? In this in-depth, beginner-friendly guide, you’ll learn how to build a complete full-stack web application using modern and popular technologies: Frontend: Vue.js (Vue CLI) Backend: Node.js with Express Database: MySQL API Communication: Axios Styling: Custom CSS with Dark Mode Support Whether you’re a frontend developer exploring the backend world or a student building real-world portfolio projects, this tutorial is designed to guide you step by step from start to finish. 🎬 Watch the Full Video Tutorials 👉 Full Stack Development Tutorial on YouTube 👉 Backend Development with Node.js + MySQL 🧠 What You’ll Learn in This Full Stack Tutorial How to set up a Vue.js 3 project using Vue CLI Using Axios to make real-time API calls from frontend Setting up a secure b...

🚀 How to Deploy Your Vue.js App to GitHub Pages (Free Hosting Tutorial)

Are you ready to take your Vue.js project live — without paying a single cent on hosting? Whether you're building a portfolio, a frontend prototype, or a mini web app, GitHub Pages offers a fast and free solution to host your Vue.js project. In this guide, we’ll walk you through how to deploy a Vue.js app to GitHub Pages , including essential setup, deployment steps, troubleshooting, and best practices — even if you're a beginner.  Why Choose GitHub Pages for Your Vue App? GitHub Pages is a free static site hosting service powered by GitHub. It allows you to host HTML, CSS, and JavaScript files directly from your repository. Here’s why it's a perfect match for Vue.js apps: Free : No hosting fees or credit card required. Easy to Use : Simple configuration and fast deployment. Git-Powered : Automatically links to your GitHub repository. Great for SPAs : Works well with Vue apps that don’t require server-side rendering. Ideal for Beginners : No need for complex...

🧠 What Is Frontend Development? A Beginner-Friendly Guide to How Websites Work

🎨 What is Frontend Development? A Beginner’s Guide to the Web You See Date: July 2025 Ever wondered how websites look so beautiful, interactive, and responsive on your screen? From the buttons you click to the forms you fill out and the animations that pop up — all of that is the work of a frontend developer. In this blog post, we’ll break down everything you need to know about frontend development:  What frontend development is  The core technologies behind it  Real-life examples you interact with daily Tools used by frontend developers  How to start learning it — even as a complete beginner 🌐 What Is the Frontend? The frontend is the part of a website or web application that users see and interact with directly. It’s often referred to as the "client-side" of the web. Everything you experience on a website — layout, typography, images, menus, sliders, buttons — is crafted using frontend code. In simpler terms: If a website were a the...