473,385 Members | 1,372 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help With Table Design

Hello everyone,

I want to create an employee license plate database and need help with
the best table design.

I was thinking three tables:

1) tblEmployees
EmployeeID
EmployeeName
EmployeeDepartment (this should be a lookup to tblDepartments)
EmployeeTitle

2) tblDepartments (this table uses so that Departments in tblEmployees
is not free formed and user must select from list)

3) tblVehicles
VehiclePlate# (Primary Key since license plates arent the same?)
VehicleMake
VehicleModel
Here is where I am having the problem.

How can I connect the tables with this in mind. An employee can work in
one department. However, an employee can have several different
vehicles?

Keep in mind that the vehicles arent always entered when the record for
the employee is created. Sometimes, an employee may add a vehicle or
change a vehicle.

Thank you,

Brian

Nov 13 '05 #1
5 2850
On 17 Jul 2005 05:19:27 -0700, "BerkshireGuy" <bd*****@yahoo.com>
wrote:
Hello everyone,

I want to create an employee license plate database and need help with
the best table design.

I was thinking three tables:

1) tblEmployees
EmployeeID
EmployeeName
EmployeeDepartment (this should be a lookup to tblDepartments)
EmployeeTitle

2) tblDepartments (this table uses so that Departments in tblEmployees
is not free formed and user must select from list)

3) tblVehicles
VehiclePlate# (Primary Key since license plates arent the same?)
VehicleMake
VehicleModel
Here is where I am having the problem.

How can I connect the tables with this in mind. An employee can work in
one department. However, an employee can have several different
vehicles?

Keep in mind that the vehicles arent always entered when the record for
the employee is created. Sometimes, an employee may add a vehicle or
change a vehicle.

Thank you,

Brian

Hi
Try running this code in a module (eg click inside the code and press
f5)
rejoin any lines which have been split by posting

Public Function aa()
CurrentDb.Execute "CREATE TABLE [tblDepartments] ([DepartmentId] LONG,
[DepartmentName] TEXT(50))"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON
tblDepartments(DepartmentId) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "CREATE TABLE [tblEmployees] ([Employeeid] LONG,
[EmployeeName] TEXT(50), [EmployeeDepartment] LONG, [EmployeeJobTitle]
TEXT(50))"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON
[tblEmployees]([Employeeid]) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "CREATE TABLE [tblVehicles] ([VehiclePlateNumber]
TEXT(50), [VehicleMake] TEXT(50), [VehicleModel] TEXT(50),
[EmployeeId] LONG)"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON
[tblVehicles]([VehiclePlateNumber]) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "ALTER TABLE tblEmployees ADD CONSTRAINT
tblDepartmentstblEmployees FOREIGN KEY (EmployeeDepartment) REFERENCES
tblDepartments(DepartmentId)"
CurrentDb.Execute "ALTER TABLE tblVehicles ADD CONSTRAINT
tblEmployeestblVehicles FOREIGN KEY (Employeeid) REFERENCES
tblEmployees(Employeeid)"
End Function

Nov 13 '05 #2
On 17 Jul 2005 05:19:27 -0700, "BerkshireGuy" <bd*****@yahoo.com>
wrote:
Hello everyone,

I want to create an employee license plate database and need help with
the best table design.

I was thinking three tables:

1) tblEmployees
EmployeeID
EmployeeName
EmployeeDepartment (this should be a lookup to tblDepartments)
EmployeeTitle

2) tblDepartments (this table uses so that Departments in tblEmployees
is not free formed and user must select from list)

3) tblVehicles
VehiclePlate# (Primary Key since license plates arent the same?)
VehicleMake
VehicleModel
Here is where I am having the problem.

How can I connect the tables with this in mind. An employee can work in
one department. However, an employee can have several different
vehicles?

Keep in mind that the vehicles arent always entered when the record for
the employee is created. Sometimes, an employee may add a vehicle or
change a vehicle.

Thank you,

Brian

Hi
Try running this code in a module (eg click inside the code and press
f5)
rejoin any lines which have been split by posting

Public Function aa()
CurrentDb.Execute "CREATE TABLE [tblDepartments] ([DepartmentId] LONG,
[DepartmentName] TEXT(50))"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON
tblDepartments(DepartmentId) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "CREATE TABLE [tblEmployees] ([Employeeid] LONG,
[EmployeeName] TEXT(50), [EmployeeDepartment] LONG, [EmployeeJobTitle]
TEXT(50))"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON
[tblEmployees]([Employeeid]) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "CREATE TABLE [tblVehicles] ([VehiclePlateNumber]
TEXT(50), [VehicleMake] TEXT(50), [VehicleModel] TEXT(50),
[EmployeeId] LONG)"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON
[tblVehicles]([VehiclePlateNumber]) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "ALTER TABLE tblEmployees ADD CONSTRAINT
tblDepartmentstblEmployees FOREIGN KEY (EmployeeDepartment) REFERENCES
tblDepartments(DepartmentId)"
CurrentDb.Execute "ALTER TABLE tblVehicles ADD CONSTRAINT
tblEmployeestblVehicles FOREIGN KEY (Employeeid) REFERENCES
tblEmployees(Employeeid)"
End Function

Nov 13 '05 #3
On 17 Jul 2005 10:30:03 -0500, watching@tv (FreeviewClipper) wrote:

Hi
I thought sending SQL would be a neat way of sending table definitions to a text newsgroup
but I forgot that if you paste split strings into an Access module it adds extra quotes, which
is too big a mess to meddle with.
You would have to join the lines in a text file before pasting into Access.
Here is a version posted with unsplit lines, not sure whether your newreader will still split them.

Public Function aa()
CurrentDb.Execute "CREATE TABLE [tblDepartments] ([DepartmentId] LONG,[DepartmentName] TEXT(50))"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON tblDepartments(DepartmentId) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "CREATE TABLE [tblEmployees] ([Employeeid] LONG,[EmployeeName] TEXT(50), [EmployeeDepartment] LONG, [mployeeJobTitle] TEXT(50))"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON [tblEmployees]([Employeeid]) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "CREATE TABLE [tblVehicles] ([VehiclePlateNumber] TEXT(50), [VehicleMake] TEXT(50), [VehicleModel] TEXT(50),[EmployeeId] LONG)"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON [tblVehicles]([VehiclePlateNumber]) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "ALTER TABLE tblEmployees ADD CONSTRAINT tblDepartmentstblEmployees FOREIGN KEY (EmployeeDepartment) REFERENCES tblDepartments(DepartmentId)"
CurrentDb.Execute "ALTER TABLE tblVehicles ADD CONSTRAINT tblEmployeestblVehicles FOREIGN KEY (Employeeid) REFERENCES tblEmployees(Employeeid)"
End Function

Nov 13 '05 #4
On 17 Jul 2005 10:30:03 -0500, watching@tv (FreeviewClipper) wrote:

Hi
I thought sending SQL would be a neat way of sending table definitions to a text newsgroup
but I forgot that if you paste split strings into an Access module it adds extra quotes, which
is too big a mess to meddle with.
You would have to join the lines in a text file before pasting into Access.
Here is a version posted with unsplit lines, not sure whether your newreader will still split them.

Public Function aa()
CurrentDb.Execute "CREATE TABLE [tblDepartments] ([DepartmentId] LONG,[DepartmentName] TEXT(50))"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON tblDepartments(DepartmentId) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "CREATE TABLE [tblEmployees] ([Employeeid] LONG,[EmployeeName] TEXT(50), [EmployeeDepartment] LONG, [mployeeJobTitle] TEXT(50))"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON [tblEmployees]([Employeeid]) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "CREATE TABLE [tblVehicles] ([VehiclePlateNumber] TEXT(50), [VehicleMake] TEXT(50), [VehicleModel] TEXT(50),[EmployeeId] LONG)"
CurrentDb.Execute "CREATE UNIQUE INDEX PrimaryKey ON [tblVehicles]([VehiclePlateNumber]) WITH PRIMARY DISALLOW NULL "
CurrentDb.Execute "ALTER TABLE tblEmployees ADD CONSTRAINT tblDepartmentstblEmployees FOREIGN KEY (EmployeeDepartment) REFERENCES tblDepartments(DepartmentId)"
CurrentDb.Execute "ALTER TABLE tblVehicles ADD CONSTRAINT tblEmployeestblVehicles FOREIGN KEY (Employeeid) REFERENCES tblEmployees(Employeeid)"
End Function

Nov 13 '05 #5
The first one worked create once I joined the lines.

Thanks!

Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Krist | last post by:
Hi All, I have a database design question, pls give me some help.. I want to define tables for salesman's sales target commission . The commission could be given per EITHER sales amount of :...
1
by: Krist | last post by:
Hi All, There is some additional info I forget on this same topic I just posted. I have a database design question, pls give me some help.. I want to define tables for salesman's sales target...
0
by: Jim | last post by:
I need some help getting started with a .NET web project for a commercial site. I am new to .NET and my understanding of some (but not all) of its concepts is a little sparse. I apologize for the...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
18
by: Jeremy Weiss | last post by:
I'm trying to build a database that will handle the monthly billing needs of a small company. I'm charting everything out and here's what I see: table for customers sub table to track payments...
5
by: Steve Patrick | last post by:
Hi All You guys are my last hope, despite spending money on books and hours reading them I still can not achieve the results I need. I have designed a database in Access 2000 based on 1 table,...
7
by: david | last post by:
I have asked this question before. But it does not work for me. Given radion buttons in the web form design page. What I did is described as follows. A panel control is dragged into the design...
1
by: stalinmaddy | last post by:
I have problem with layers in my code. The problem is that it works well with ordinary html files but when include with any other files which have flash script or more javascript it doesn't...
4
by: yanjie.ma | last post by:
Hi, I've got a two part question on table and form design (sorry for the length but it takes a bit to explain). Our sales department uses a look-up table to help the them select the best...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
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
0
BarryA
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...
1
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...
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.