I'm looking at my SQL code in Microsoft Access and I see nothing wrong. I try to run the query and it says "syntax error in create table statement."

CREATE TABLE Authors 
(
    Au_Num      INT (3) PRIMARY KEYA,
    Au_LName    VARCHAR (10) NOT NULL,
    Au_FName    VARCHAR (10),
    Book_Number INT (2),
    Client_Name VARCHAR (20)
);

2 answers

  • answered 2022-01-23 03:01 June7

    Removing the parenthesized numbers from INT declarations works:

    CREATE table Authors (
    Au_Num INT Primary Key,
    Au_LName VARCHAR(10) NOT NULL,
    Au_FName VARCHAR(10),
    Book_Number Int,
    Client_Name VARCHAR(20)
    );
    

    If the primary key should be an autonumber:

    CREATE table Authors (
    Au_Num AUTOINCREMENT Primary Key,
    Au_LName VARCHAR(10) NOT NULL,
    Au_FName VARCHAR(10),
    Book_Number Int,
    Client_Name VARCHAR(20)
    );
    

  • answered 2022-01-23 03:23 Moulitharan M

    Data types such as int, bigint, datetime, smallint, tinyint, bit, bool and date has predefined length, hence it is not required to specify the length explicitly.

    Remove the length for int data types

    create table Authors (
    Au_Num      INT  Primary Key,
    Au_LName  VARCHAR (10) NOT NULL,
    Au_FName  VARCHAR (10),
    Book_Number Int,
    Client_Name   VARCHAR (20)
    
    );
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum