Cameroon Finance

Aug 28 2017

Create Tables In Access 2010 Using SQL Commands #microsoft #access #sql #commands


#

Create Tables In Access 2010 Using SQL Commands

MS Access provides a number of ways to create tables and queries. Using simple SQL commands, you can create tables, queries, forms, and reports. SQL stands for Structured Query Language that is being used extensively for creating, handling and manipulating RDBMS. Its syntax is very easy to comprehend, but becomes complex when you try to handle the colossal database. In this post we will define a simple query with SQL commands, which eventually creates a simple table.

To start off with, Launch Access 2010 and give database an appropriate name. Once done, click Create.

It will open a blank table, close it in order to remove it. Now, navigate to Create tab and click Query Design.

RECOMMENDED FOR YOU

Upon click you will see Show Table, close this dialog box.

It will open Querytab1. Here, you can write SQL commands. Since we want to create simple table. we will write SQL commands to create table and important field labels with their respective data types.

In SQL commands, we started off with CREATE TABLE, this will create a table with the name specified Student. The first field label ST_ID with data type int (Integer), we have also set it as PRIMARY KEY (unique identifier and non-repetitive). The next field label Name has data type CHAR ( 255) or Text. The last field label Present has data type YESNO, which confines your database users to enter either Yes or NO.

As you can see in SQL commands, we have enclosed field labeling data type section in parenthesis and placed semicolon at the end. Syntax error would erupt if you don t comply with these standards.

Now, save the query by right-clicking Query1 tab and hit Save. Specify an appropriate name for it.

You will see the newly created query through Data Definition in the left sidebar of the database window.

Now run this query. a message window will pop-up, asking you to confirm the action. Click Yes to continue.

Upon click, it will do as specified in SQL command; it will create a table by the name of Student, as shown in the screenshot below.

On opening newly created table, you will see all the field labels as specified in SQL commands. As shown in the screenshot below that it has all the column labels; ST_ID, Name, Course, Marks, Grade, Phone, and Present.

Now switch to Design view and check the Data types. Here, you can apply new constraints for table data fields and add more field labels etc.


Written by admin


Leave a Reply

Your email address will not be published. Required fields are marked *