Hello everyone,
I worked through my first database and have gone back to the assignment one about the court.
I seem to be having a great deal of trouble creating tables.
for example
create table(crown court),
crowncourtno (autonumber),
telno text (15),
numberofseats text(5),
constraints crowncourtno primary key_pk ));
I am using access 2003, it doesnt seem to like the brackets or the commas, and when i get rid of them it doenst like the names. I've been following advice on here, out of books and still its not working.
so please help.
sunday
9 6593
Hello everyone,
I worked through my first database and have gone back to the assignment one about the court.
I seem to be having a great deal of trouble creating tables.
for example
create table(crown court),
crowncourtno (autonumber),
telno text (15),
numberofseats text(5),
constraints crowncourtno primary key_pk ));
I am using access 2003, it doesnt seem to like the brackets or the commas, and when i get rid of them it doenst like the names. I've been following advice on here, out of books and still its not working.
so please help.
sunday
Do not post questions in the articles sections.
Moved to the forum section.
so sorry I posted in the wrong place ( I was wondering why I hadnt had a reply)
I was wondering when creating tables in sql is the order you do them important and prehaps i should wait to create them all before runing them.
hope somone can put me on the right road.
sunday
Hi, I'll show you an example of creating a table in through SQL. The table is simple but you should be able to gather the format of things from it. -
CREATE TABLE tblEmployee
-
(
-
empID COUNTER,
-
empFName TEXT(25) NOT NULL,
-
empLName TEXT(35),
-
deptID number,
-
CONSTRAINT pk_employee PRIMARY KEY(empID),
-
CONSTRAINT fk_employee FOREIGN KEY(deptID) REFERENCES tblDept(deptID)
-
)
-
The order in which you create tables is important. You must create parent tables before creating child tables. So in this example I would not be able to create the employee table with a foreign key constraint on deptID if tblDept had not yet been created.
thanks so much for that,
I've been racking my brain on how to create them correctly, this database that i am working on has so many different tables.
I will keep trying now.
thankyou
sunday
HI again,
I've been getting along really well creating these tables but have hit another problem.
here is what I am trying to do.
create table case
(
caseno text (4),
judgeno text (4),
barristerno text (4),
constraint pk_caseno primary key
constraint fk_caseno foreign key (booking) references booking (caseno)
constraint fk_judgeno foreign key(judge) references judge (judgeno)
constraint fk_barristerno foreign key (prosecuting barrister) references barristerno (prosecuting barrister));
I have managed to create all the other tables with the foreign keys in, but cant seem to get this one to work.
please tell me what I am doing wrong again, its so frustrating.
sunday
I'm assuming you're trying to create the intermediate table in a many to many relationship. The three fields make up the primary key but they are also there own seperate foreign keys. Make sure to backup what you have before trying this out. -
CREATE TABLE case
-
(
-
caseNo text(4),
-
judgeNo text(4),
-
barristerNo text(4),
-
PRIMARY KEY (caseNo, judgeNo, barristerNo),
-
FOREIGN KEY (caseNo) REFERENCES tblBooking(caseNo),
-
FOREIGN KEY (judgeNo) REFERENCES tblJudge(judgeNo),
-
FOREIGN KEY (barristerNo) REFERENCES tblBarrister(barristerNo)
-
)
-
thankyou again,
I have managed to create all my tables now and enforced the intergrity in the relationships table.
I was wondering if there is a way of inserting the data in groups?
At the moment I am inputing it one row at a time.
I am using the insert statement ie
insert into ( field 1, field2, field3)
values '1', '2' '3';
thanks again
sunday
ok I take it that I must imput the data one row at a time.
I would have thought that there would have been an easier way.
sunday
ok I take it that I must imput the data one row at a time.
I would have thought that there would have been an easier way.
sunday
Have you got the data somewhere else? Excel, text file, etc.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ToMeK |
last post by:
hi! i'm trying to builid web catalog and i'm having problems with organizing
my tables. here's what i want:
i have main categories, sub_categories and articles like this:
CATEGORY_1
SUB_CAT_1...
|
by: Brian S. Smith |
last post by:
Hi gang,
Please help. I've been through the Access help, searched the Web, and
I can't seem to get a straight answer. As the Subject line suggests, I
want to run a fairly simple VB/Access Sub...
|
by: sea |
last post by:
Is it a good idea to programatically create a primary key? For example
in a table called names, I have the following fields, (1) firstname
(2)lastname (3) ID
- will it be ok to create a primary...
|
by: flkeyman |
last post by:
Work in legal office. Trying to create solid designed database
structure. This is list of tables w/fields and primary keys. Any
comments/advice greatly appreciated.
tbl-Defendants
CaseNumber...
|
by: Wilfried |
last post by:
Hi,
I have 5 tables:
main
data1
|
by: Mindy |
last post by:
Hey,
I want to create links between my two tables. The primary keys of these
two tables are character variables, with length =11. I followed exactly
the instruction of Dummuy Book for ACCESS...
|
by: teedilo |
last post by:
Our MS SQL (SQL Server 2000) DBA has database privileges locked down
pretty tightly. We end users/developers do not have administrator
privileges for most databases. That arrangement has worked...
|
by: bobby_b_ |
last post by:
I have a table where fields 1 and 2 make up the primary key.
Because of this, I have a unique composite index on fields 1 and 2 (as
required by DB2). Now my question is: Fields 1 and 2 are also...
|
by: max |
last post by:
Hello,
I am a newbye, and I'm trying to write a simple application.
I have five tables with three columns; all tables are identical; I need to
change some data in the first table and let VB...
|
by: shreedhan |
last post by:
I have two tables table1 and table2
Table1 has a foreign key which references key of table2
Table2 also has a foreign key which references key of table1
Now when I try to insert into any of...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |