Good Table Design...
Jul 20, 2005
Hello,
I am designing a table of vehicle types, nothing special, just a list of
unique vehicle types such as truck, lorry, bike, motor bike, plane, tractor
etc etc
For the table design I am proposing a single column table with a field name
called vehicle_type and this will contain the vehicle type.
Sot it will be
vehicle_type
car
bike
tractor
plane
truck
van
blah
blah
blah
Is this ok? Or is there a better way to do it?
Thanks,
td.
View 36 Replies
ADVERTISEMENT
Dec 29, 2007
Hey I was wondering if you
all could help me with my database. I am very noobish as databasing and I am
not sure what I have is good or bad. This is very long since I tell you basically
what my whole site does/will do. This is in hopes that it will give you a
better understanding of how many database will work.
Japanese WebSite
Purpose of the site:
This sites intention is to help people learn the 2 basic
Japanese character sets Hiragana and Katakana.
Hiragana is usually used for Japanese words and contains 46 basic characters,
plus a set of special characters. Katakana is usually used for foreign words
and also contains 46 basic characters plus a special set of characters.
Hiragana and Katakana are written differently when they are written with Japanese
characters. However if you right them in romaji (this is basically writing words
as if you where writing English and does not involve using characters. This is
used for foreigners while they are learning how to write the Japanese
characters).
Hiragana and Katakana are pronounced exactly the same.
This site will use a quiz style format. The user will first choose from the set
of Hiragana characters then the Katakana characters. Once chosen the website
will randomly choose a character and display the Japanese symbol of it. The user will then write the romaji
representation in the text box provided.
It will be then checked
and if the user is right they will get a new symbol. If they are wrong they
will have try again. The purpose for
this is for the user to get use to see how the character looks like but at the
same time writing in romaji what will be easier for them. This should make it
easier for them the next time they see the character to know how to say it.
Version 1
The site will go through many versions. This version I am
focusing on using C#,asp and ms sql. Later on in future versions ajax and
javascrip will be introduced and parts will be changed. Version 1 also uses CSS
and html.
Version 1 will contain these features.
1. A
practice section. A user will go through a wizard like setup that will first
let them choose from the basic 46 Hiragana characters (the other special
characters will be added later). They will then go to the next setup and choose
from the 46 basic Katanana characters. After they go to another section that
asks them how many repetitions they want to go through. If the user is a member(free membership) they
will have the option to save their settings that will be stored and later
available on the front page called quick links. The next page of the wizard is
actually going through the quiz. Once they are done they will see a summary of
how many they got right,wrong and how many they needed assistance on. At this
point they will be able to view a chart to see their progress(current chart
showing there last attempt, a week one
and a month one). These charts will be either made using c# or ms sql(I saw a
something that says you can make something like that but have not confirmed
it). I may do both ways for a learning experience.
2. A Registration form, login and logout.
3. Quick
link. Quick link will be for registered members so they don’t have to go
through the wizard every time to make their practice quiz up. A user will go
through the wizard once and choose what they want and save it. Quick link will be on all the pages in the
form of mostly likely a grid view. A user will be able to store 3-5 different quiz’s
(in the future maybe more). A user can then click on the quick link and it will
just take them to the quiz. The user will also will be able to update their
quiz through the grid view. This will take them to the start of the wizard and
they can go through it again and then just save over it. They will also be able
to delete there quick links through the grid view.
Currently done
Half of step 1 has been completed. Currently a user can
go through the wizard and select what they want and choose how many repetitions
and go through the quiz. However the summary and charts are not done.
Future versions.
Design will be a major part of it since I have not
focused on this at all. Also since I wanted to experiment with dynamic controls
I made all the checkboxes for the selections dynamically. This caused a problem
that a user must hit a save button since the controls have to get recreated and
updated.
I think normally this might not have been a problem but
since I since I am using a multiview(to create a effect that the wizard is all
on the same page and not the whole page has to be reloaded) it caused some
problems(I can’t really remember since it was a couple months ago when I
started but had to stop due to the amount of school work). This is why I want
to go back later and make them with ajax. This also makes another learning
experience.
Where I am at now.
When I started this I really did not think much of my
database mainly because I am not good at data basing and don’t really like it that
much. I have had a course in data basing (was with oracle though)that was part
of my program. At the time I did not understand very much since I found the
teacher going too fast and he started at chapter 8….. Also when you got 7 other
courses with it it’s hard to learn lots.
I have gone through some tutorials and stuff. I am not
very keen on reading a database book since I just don’t have the time since I
want to also read a book on c#, javascript, ajax and so forth. Also I don’t
know how much I will retain/learn from a book. With some of the stuff I just
find its better to try to something where you will be interested in and then
when needed read chapters of a book or ask questions. This is what I done for my c# stuff like I
had a c# with asp course and 2 months after the courses I started this site and
I had to ask myself what the heck did I learn in that course since it seemed I
knew nothing(and I was close to top in my class). With pounding it out and
reading I was able to accomplish what I needed. Like I still want to read a
book on C# but for now it’s just not going to happen same with Data basing.
All the pervious information was so you can understand
what my website is trying to do so you can better evaluate my database design
and answer my questions.
First Design of my
database.
This is when I just made it up on the spot and did not do
any database design or anything.
Question 1: I
forgot how to limit select query results. Like If I just want to show 10 query
results how do I do this?
I have currently 2 tables How one called Hiragana and the
other Called Katakana
HiraganaID = PK
HiraganaID HiraganaCharacter HiraganaImage
----------- -----------------
--------------------------------------------------
1 a Images/hiragana/a-o/a.jpg
2 i Images/hiragana/a-o/i.jpg
3 u Images/hiragana/a-o/u.jpg
4 e Images/hiragana/a-o/e.jpg
5 o Images/hiragana/a-o/o.jpg
6 ka Images/hiragana/ka-ko/ka.jpg
Katakana
KataKanaID = PK
KatakanaID KatakanaCharacter KatakanaImage
-----------
-------------------------------------------------- --------------------------------------------------
1 chk_Kata_a
Images/katakana/a-o/a.jpg
2 chk_Kata_i
Images/katakana/a-o/i.jpg
3 chk_Kata_u Images/katakana/a-o/u.jpg
4 chk_Kata_e
Images/katakana/a-o/e.jpg
5
chk_Kata_o
Images/katakana/a-o/o.jpg
I quickly found that this design was very bad since I was
unable to add new rows very easily. Each character set has each of its characters
in rows of 5. Some rows however have only 3 romaji characters so what they do
is leave the other cells blank representing that they don’t exist. I wanted to
do this too so I figured the easier way would be to have just null rows of
data. So say for “ya,yu,yo� it would be like this “ya,null,yu,null,o�. That’s
how it would appear in the database so when my c# would read it in it would not
have to account for rows that had less than 5 characters since it would have
already the nulls for it.
You can check a chart out here: http://www.alpha.ac.jp/japanese/img/moji.gif
So with this poor design it would result me in basically
rewriting the database.
I have thought of 2 possible ways to. I am not sure if
either way is good but I will try to explain my reasoning as much as I can.
Possible Way 1
In this approach I have 5 tables.
Hiragana
This table stores all the information about Hiragana
Characters
CREATE TABLE [dbo].[Hiragana](
[HiraganaID] [int] IDENTITY(1,1) NOT NULL,
[HiraganaCharacter] [varchar](5) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
[HiraganaImage] [varchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
[SortOrder] [numeric](3, 0) NOT NULL,
CONSTRAINT [PK_Hiragana] PRIMARY
KEY CLUSTERED
Katakana
This table stores all the information about Katakana
Characters
CREATE TABLE [dbo].[Katakana](
[KatakanaID] [int] IDENTITY(1,1) NOT NULL,
[KatakanaCharacter] [varchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
[KatakanaImage] [varchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
[SortOrder] [numeric](3, 0) NOT NULL,
CONSTRAINT [PK_Katakana] PRIMARY
KEY CLUSTERED
Quick Links
This table will store the users quick link information.
CREATE TABLE [dbo].[QuickLinks](
[QuickLinkName] [varchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[UserID] [int] NOT NULL,
[SavedCharacters] [varchar](200) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[SavedImagePaths] [varchar](200) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
Users
This will store login information.
CREATE TABLE [dbo].[Users](
[UserID] [int] IDENTITY(1,1) NOT NULL,
[UserName] [varchar](30) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[EmailAddress] [varchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Password] [varchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NOT NULL,
[DateTimeStamp] [smalldatetime] NOT
NULL,
CONSTRAINT [PK_Users] PRIMARY
KEY CLUSTERED
Charts
This will store all information that will be used for
charts.
CREATE TABLE [dbo].[Charts](
[PracticeNum] [int] IDENTITY(1,1) NOT NULL,
[UserID] [int] NOT NULL,
[Correct] [numeric](3, 0) NOT NULL,
[Wrong] [numeric](3, 0) NOT NULL,
[AssitanceNeeded] [numeric](3, 0) NOT NULL,
[TimeDateStamp] [smalldatetime] NOT
NULL,
CONSTRAINT
[PK_Charts] PRIMARY KEY
CLUSTERED
(
Relationships
Users and QucikLinks have a PK to FK relationship this is
because quicklinks is dependent on the user having a user account. It also away
to identify which QuickLinks will belong to who.
Question 2: Currently I don’t have a primary Key for this
table what would be a good primary key for this table?
QuickLinks also does not have any relationship to either
to HiraganaCharacters or Katakana Characters. This is because I did not feel it
was necessary to grab the information from here. I simply could just grab it
from the array that holds this information from my c# code.
Question 3: How can I make this table for all users? Like
Say they choose 5 characters and save it as QuickLink1(as the
QuickLinkName). Should each of these 5
characters gets its own line or should it all be saved in one row? Or should I
even have another table to hold this data?
Option 1
QuickLinkName UserID
SavedCharacters SavedImagePaths
---------------- ----------- ------------------- --------------------------
QuickLink1 1 a image/a.jpg
QuickLink1 1 i image/i.jpg
QuickLink1 1 u image/u.jpg
QuickLink1 1 e image/e.jpg
QuickLink1 1 o image/o.jpg
QuickLink1 2 a image/a.jpg
QuickLink1 2 ya image/ya.jpg
QuickLink1 2 ki image/ki.jpg
QuickLink1 2 yo image/yo.jpg
QuickLink1 2 n image/n.jpg
Option 2
QuickLinkName UserID
SavedCharacters SavedImagePaths
---------------- ----------- ------------------- --------------------------
QuickLink1 1 a,i,u,e,o image/a.jpg, image/i.jpg,
image/u.jpg, image/e.jpg,
image/o.jpg,
QuickLink2 2 a,ya,ki,yo,n image/a.jpg,
image/ya.jpg,
image/ki.jpg, image/yo.jpg,
image/n.jpg,
Charts table also has a Relationship with Users
The thinking for this one is that Charts will use the
UserID to tell who this data belongs too. It will store the number of correct
answers, wrong answers and AssitanceNeed. This table will also hold a timeDateStamp.
The reason for this is because I want to have a chart that displays the last
Quiz they did and also the stats of a week’s worth of quizzes, and month’s
worth of quiz’s. With a timeDateStamp I should be able to add up all those columns
and then display them for whatever period I choose.
Second Possible
Way.
Characters
CREATE TABLE [dbo].[Chracters](
[CharacterID] [int] NOT NULL,
[CharacterName] [varchar](5) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
[CharacterPath] [varchar](50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL,
[SortOrder] [numeric](3, 0) NOT NULL,
CONSTRAINT [PK_Chracters] PRIMARY
KEY CLUSTERED
This way uses 4 charts instead of 5. The main difference
is that the Hiragana Charts and Katakana Charts have been merged into one
table.
This way has another relationship between Characters and
Quick Links. This will store the Character
ID instead of the actual Characters and Path through the use of C# code. When a
user selects a box it will make a note of the CharacterID. When it is time for
the user to use the QuickLink it will join the tables together and filter out
the CharacterIDs. Giving me the CharacterName and Path.
The problem with this way is that well the code I written
will need to be changed since currently it grabs stuff from 2 tables into one.
I don’t know if this would save anytime over the first way either.
I hope these are sort of close to an alright design since
I did try to think about how my website would interact with the database.
Sorry for it being so long.
Summary of Questions
Question 1: I
forgot how to limit select query results. Like If I just want to show 10 query
results how do I do this?
Question 2: Currently I don’t have a primary Key for this
table what would be a good primary key for this table?
Question 3: How can I make this table for all users? Like
Say they choose 5 characters and save it as QuickLink1(as the
QuickLinkName). Should each of these 5
characters gets its own line or should it all be saved in one row? Or should I
even have another table to hold this data?
View 9 Replies
View Related
Aug 18, 2015
I would like to create a table called product. My objective is to get list of packages available for each product in data grid view column while selecting each product. Each product may have different packages type (eg:- Nos, CTN, OTR etc). Some product may have two packages and some for 3 packages etc. Quantity in each packages also may be differ ( for eg:- for some CTN may contain 12 nos or in other case 8 nos etc). Prices for each packages also will be different that also need to show. Â How to design the table..Â
Product name  : Â
Nestle milk |
Rainbow milk
packages  :
CTN,OTR, NOs |
CTN, NOs
Price:
50,20,5 |
40,6
(Remarks for your reference):CTN=10nos, OTR=4 nos Â
| CTN=8 Nos
View 3 Replies
View Related
May 17, 2006
I have a situation where I need a table if bad items to match to. Forexample, The main table may be as:Table Main:fd_Id INT IDENTITY (1, 1)fd_Type VARCHAR(100)Table Matcher:fd_SubType VARCHAR(20)Table Main might have a records like:1 | "This is some full amount of text"2 | "Here is half amount of text"3 | "Some more with a catch word"Table Matcher:"full""catch"I need to only get the records from the main table that do not haveanything in the match table. This should return only record 2.
View 1 Replies
View Related
Feb 28, 2007
I use a redirect row method for error of OLE DB Destination For sqlServer2005.
For some resone even though only 1 record has error and should be redirect, all the record in the current batch (I think depending on the "maximum insert commit size") are redirect. the only way for me to get the exact bad record is to set the above parameter to 1, but then it takes hours to run the package.
also I always get the same error in the errorCode column - " -1071607685"
why???
View 8 Replies
View Related
May 6, 2015
We need to Insert/Update a Fact Table from staging Table. currently we are using a SP which update Fact Table for Each region. this process is schedule, every 5 min job is run and Update fact table.but time of Insert and Update too long from staging to Fact, currently we are using merge statement for Insert and update.in my sp we are looping number how many region we need to update and at a time single Region we are updating using while loop in current SP.
View 7 Replies
View Related
Oct 7, 2015
I have a requirement of table partitioning. we have 10 years of data on a table which is 30 billion up rows on 2005 server we are upgrading it to 2014. we have to keep 7 years of data. there is no keys on table or date column. since its a huge amount of data and many users its slow down the process speed. we are thinking to do partition on 7 years for Quarterly based. but as i said there is no date column on table we have to use reference table to get date. is there a way i can do the partitioning with out adding date column on table? also does partition will make query faster?Â
I have think three ways to do it.
1. leave as it is.
2. 7 years partition on one server
3. 3 years partition on server1 and 4 years partition on server2 (for 4 years is snapshot better?)
View 3 Replies
View Related
Jul 30, 2015
I have to tables like given below Landing table "A" (Data load will happen over here, No primary keys mentioned over here) table "B"Â .Now I want to move the data from A to B.I have made use of below query insert into B select * from A...Landing table "A" has huge no of records, MS SQL server is taking huge amount of time.any alternative way to make this insertion process faster?
View 6 Replies
View Related
Apr 30, 2008
Hi, I am developing an application to a garment factory. I have a doubt in designing a table.Basic tables:Jobs, JobColors, Material, Units, Currencies ...These tables are designed with normalization rules.I got a problem at PurchaseOrderDetailsMain
table is JobMaterial. It has materialid, jobid, supplierid, description
and TypeFactor(which represents the type of order) means that the
material is ordered based on size or colors or total qty.1 for ByColor, 2 for BySize, 3 for ByQty, 4 for By Contrast colorsThe main problem at the details of the sub table.JobMaterialDetailsIf typefactor is by size, i need to store the details based on sizeex: S - 2000pcs, M - 4000pcs, L - 4000pcs, XL - 2000pcsSo I will have 4 records per each sizeIf it is by color, White - 3000pcs, Portabella - 5000pcs, Black - 2000pcs.If it is by general, Total qty 10000pcsHow
can I design this table. If I take, ColorOrSize column, it will refer
different values for diffrent typefactor. When by size, it will have
Size and when by color, it will refer colorcode.But colors are having referential integrity. So it is violated other than by color as typefactor.What is the best way to design this table?Can anybody suggest?Thanks in advance
View 2 Replies
View Related
Jul 24, 2000
I am desingning a table and i have a column OrderID and another column call Order, is neccessary to use a primary key, because One OrderID may have many Orders?
Thanks.
View 5 Replies
View Related
Aug 21, 2000
Coming from a support background and having to design my first database I have a couple of questions re- table design. Firstly I have set up several tables and included one field (of the same name) in each. This is a primary key in one table with an incremental seed. I would like this info to appear in the other tables although these can be duplicates in the other tables. How is it best to achieve this relationship. From reading it suggest FK in the relationship application but looking at other databases this seems to have been achieved by some other means. Is it more common to use stored procedures to enforce this? If so please add pointers. Secondly, I have set up a couple of master tables to act as looks ups for fields in other tables. Again how do I get this to look up the table - is it done through stored procedures or at the time of writing the front end application?? Sorry if this is all basic stuff but it is new to me.
Thanks for any help
View 1 Replies
View Related
Oct 26, 2004
CREATE TABLE [dbo].[table1] (
[aaa] [bigint] IDENTITY (10000, 1) NOT NULL ,
[bbb] [int] NOT NULL ,
[ccc] [int] NOT NULL ,
[ddd] [bigint] NOT NULL ,
[eee] [int] NOT NULL ,
[ffff] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[gggg] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[hhh] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[iii] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[jjj] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[kkk] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[lll] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[mmm] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[nnnn] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ooo] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ppp] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[qqqq] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[rrrr] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ssss] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[tttt] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[uuuuu] [varchar] (2000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[vvvvv] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[wwwww] [varchar] (150) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[xxxxx] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[yyyyy] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[zzzzz] [int] NULL ,
[abc] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[def] [datetime] NULL ,
[ghi] [datetime] NOT NULL ,
[jkl] [varchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[mno] [bigint] NULL
) ON [PRIMARY]
I have created a table with above column width. The rowsize is more than 8kb.And the table holds millions of rows of data. So is it a correct way of designing the table?
Or how can I redesign this table.
Thanks.
View 1 Replies
View Related
Mar 16, 2004
I'm currently developing a real estate system to manage order processing and work flow. I'm a little uncertain as to how to design the tables because an order can have N number of applicants, owners, buyers, and properties. There are cases where there are 9 different buyers and some where the number of properties exceeds 20. It seems that normalization might make the situation crazy, but I'm a touch rusty. Thanks.
View 2 Replies
View Related
Apr 16, 2004
I am developing an estimating application and at the "quantity takeoff" level, all products/equipment/sub contracting/etc.... end up on the same table because of the common elements:
Item | Quantity | Unit Price | SubTotal | Total
Now, since the unit price of a product is not determined from the same tables as the unit price of equipment rentals or sub contract work, etc...
how do I direct the attention to the appropriate table when trying to obtain the unit price or edit the unit price etc...
If my question is not clear, let me know, I will try to clarify.
Mike B
View 3 Replies
View Related
May 10, 2008
Hi,
Is there a way to copy and save my Design Table? I want to transfer it to another workstation.
View 8 Replies
View Related
Feb 13, 2006
Hi am trying to figure out my table design need some advice
I have a table that catches the telephone numbers of a customer , there are 5 telephones for each customer. All the numbers are there in the DB
Should I create the design in the following format
CustomerName
Tel1
Tel2
Tel3
Tel4
Tel5
Or Should I have
Customer
Telephone
& then have 5 rows for each customer
Please advice
I even wanted to knw how should the design be , if all the Tel Nos are not captured, I mean what if some customers have 3 tel Nos, while some may just have 1 while some may have all 5
Thanks
View 7 Replies
View Related
Aug 21, 2006
Hi I'm having trouble figuring out this database design and normalising the data. Following are the tables and I am wonder if it can be normalised any further. This is a database of Architects and their work history and building they have designed.
Architects:
FirstName
LastName
Gender
DOB
Bio
Works:
Title
Client
Type_of_Building
Style
Address
Year_Designed
Year_Completed
Comments
Architect_ID
Firm: (this is the various firms that the architect has worked for)
CompanyName
Address
EmploymentHistory: (when the architect worked with a particular firm)
Year_Start
Year_End
Firm_ID
Architect_ID
Publication: (where the architects works were published)
Author
Date_Publication
Title
Source
Publisher
Architect_ID
I would really appreciate some help and suggestions on creating the relationships.
thanks
View 5 Replies
View Related
Sep 17, 2007
I create following tables.
employee table
------------------------
EMP_ID varchar
NAME varchar
DEPARTMENT_CODEint
POSITION_CODEint
COUNTRY_CODEint
department table
------------------
DEPARTMENT_CODEint
DEPARTMENT_NAMEvarchar
position table
---------------
POSITION_CODEint
POSITION_NAMEvarchar
country table
-------------
COUNTRY_CODEint
COUNTRY_NAMEvarchar
In employee table I have to store two country names.
ie. employee currently working in this country
but his home country name (origin country) is another
name. In country table all countries information available.
ie. country_code and country_name.
How I can design the employee table that it get country_name from COUNTRY TABLE ?
but we can not use same country_code in two fields.
OR
otherwise I will have to create employee table like this
employee table
------------------------
EMP_ID varchar
NAME varchar
DEPARTMENT_CODEint
POSITION_CODEint
COUNTRY_CODEint
COUNTRY_NAMEvarchar
ie. during data entries direct insert the country_name in employee
table ?
I want to create separate table for separate data.
department,postion,country.
How I can use unique country_code in employee table's two
fields ?
regards
Martin
View 2 Replies
View Related
Nov 8, 2007
Hi,
I'm struggling coming up with an optimal table design for the following scenario.
I have a table in which each row is recording information about a document - author, publisher, publication, title, abstract and so forth. I also have an image table which contains information about the images which can be associated with the documents.
Each document can have on of three image types associated with it - an author photo, a publisher logo and a publication logo. There aren't actually that many different authors, publishers and publications in the database so it would be common for many documents to have the same author or the same publisher although authors sometimes write for different publications. In the current setup it's possible for a document to have more than one image of each type associated with it, which is undesirable - this needs to eliminated and we need to ensure that each document can only have one image of each type associated with it.
It'd also be a huge boon if I could get all the information about a document and it's attached images with a single database call. In the current setup, trying to do this returns multiple rows so I've ended up making two calls, one for the document and one for it's attached images.
I can see two possible ways of setting this up, neither of which appeal.
The first is to add three columns to my document table to record the image URLs which is simple but inflexible should I want to add more image types later on.
The second is to set up three new tables for author, publisher and publication and associate each of these with the document table through a key and then to the image table through another key. There's also an image type table which is going to come in to play. I'm unwilling to do this because it's going to just explode the number of tables I've got, especially if we add more image types, and play havoc with my XML schemas.
Is there another way of rationalizing this that I've missed?
Cheers,
Matt
View 3 Replies
View Related
Jan 11, 2007
Hi,
I am trying to decide between 2 table designs. I basically have several different types of work items that need to be tracked. Each work item has their own set of statuses, some of which may be the same as other work item's statuses, some of which will be unique for that work item.
Now, should I create one status table for each work item, or would it be better to use one status table, but add a column to track which work item the status belongs to?
I'm not sure which is a better design, or perhaps there is some alternate design that is better. Any help is appreciated.
Thx.
View 1 Replies
View Related
Sep 20, 2007
Currently I need to design database table and got stuck.
I have a project and its sub projects. A parent project and its sub projects share the same requirement.The description of the requirement will be changed every day.
For example
Project A - Do Some thing 1 on Project A [09/28/2007]
Project A-A1 - Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007]
Every time the comments updated, both project A and project A-A1 should share the same update i.e select project A and its subproject will be displayed
Project A Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007]
Project A-A1 Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29//2007]
When you tried to insert new sub project, the requirement will be shared with the parent project ie.
Project A - Do Some thing 1 on Project A [09/28/2007]
Project A-A1 - Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007]
Project A-A2 - Do Some thing 1 on Project A [09/28/2007] , Do Some thing 2 on Project A [09/29/2007] , Do Some thing 2 on Project A-A2 [09/30/2007]
assume Project A-A1 and Project A-A2 are sub project of project A
Could anyone show me how to design the database table for those mess?
Thank you
View 6 Replies
View Related
Jan 3, 2008
Hi All,
If I have the following data that I need to put in a lookup table, what would be considered the proper create table schema for it?
G, "Group"
R, "Region"
D, "District"
Would you setup your table like this:
Level_ID Varchar(1),
Level_Desc Varchar(20)
Or would you go ahead and create like this
Level_ID Integer,
Level_Code Varchar(1),
Level_Desc Varchar(20)
Not sure which one would be the preferred method.
Thanks,
JJ
View 5 Replies
View Related
Dec 17, 2007
I have a huge database and off lately, I have been experiencing some performance issues on some queries. Some of my tables now have over 10 million records. I noticed the performance issue was caused mainly from one table created as a work around. If I remove the column from the workaround table (but still leave the table in the query), I get the results in 1 second. However if I include a column from the workaround table, the same query takes 14 seconds (same output only an extra column) . I will appreciate any advise on a better design to get around my workaround table.
Below is my scenario
Table - Team
-------------------
Column -
TeamID (Primary Key)
TeamName
Table - Matches
---------------------------
Columns -
MatchID (Primary Key)
MatchName
Team1ID (Foreign to "TeamID" in Table "Team")
Team2ID (Foreign to "TeamID" in Table "Team")
Table - Players
----------------------
Columns -
PlayerID (Primary)
TeamID (Foreign to "TeamID" in Table "Team")
PlayerName
The above tables work very well... The tables I listed below are my cause of issue... I need to write a query to list every match with the names of players who played in it comma delimited (one row per match).
I created a table
Table - MatchPlayer
-----------------------------
Columns -
MatchPlayerID (Primary)
MatchID (Foreign to "MatchD" in Table "Match")
PlayerID (Foreign to "PlayerD" in Table "Player")
But I couldnt write a query that would list me all the players comma delimited in one row per match..
So I put a workaround
Table - MatchPlayer1
-----------------------------
Columns -
MatchPlayerID (Primary)
MatchID (Foreign to "MatchD" in Table "Match")
Team1PlayerNames (Comma Delimited values - varchar(800))
Team2PlayerNames (Comma Delimited values - varchar(800))
This allows me to easily list the player names comma delimited per match but is a very bad design. Is it possible to list the same using the table Match Player.
Thanks in advance
View 5 Replies
View Related
Jan 3, 2007
hi there,im new to sql server 2005 and this forum
need help here pertaining to the database table definitions
all was well when i started using it a month or 2 ago until now that when i tried to redesign my tables,it wouldnt prompt me to choose a primary key for my table
previously what happened was that when i saved the table without selecting an attribute as a primary key,it would prompt me to do so nu could choose to have the primary key auto-generated
but now it seems it stopped prompting me about it
whats wrong with it?anyone else faced this?
pardon my question,im a noob at this sql server thingie
thanx in advance!
View 12 Replies
View Related
Jun 23, 2006
We are in the early stages of developing a small project and I have a question I would like an opinion on.
When deciding how to design a table to store information on users who will be different types.
The project involves setting up webpage that allow " appointment setters" to book demos for our Sales reps. We want to keep track of how many each appointment setter books.
I have a user table with user_id, fname,lname, type. Where type represents the type of users they will be either "appointment setter" or "Sales Rep".
In the Appointment table I would like to store the Appoinment setter ID, sales rep Id, date/time appointment was booked and some other data on the appointment.
My question is how do I set up the relationship from the appointment table back to the user table.
Since each record in the appointment table will have a App Setter ID and a Sales Rep ID.
Should I just pick either the app setter id or the sales rep id as the foreign key back to the userID in the user table. Or is there another method how to handle this.
Any thoughts or articles would be greatly appreciated.
thanks,
View 1 Replies
View Related
Jun 3, 2008
hi,
i have a table with data in the following format (dont ask why it was done this way, its not something i can change)
so my table looks like this:
point :timestamp :value
_________________________
var1 11:00 5
var2 11:00 2.3
var3 11:00 21
var1 12:00 5.2
var2 12:00 2.4
var3 12:00 18
and so on.
i would like to have my data rearranged to look like the following:
timestamp :var1 value :var2 value :var3 value
________________________________________________
11:00 x y z
12:00 a b c
....
i am working with my database in a c sharp application. so if anyone does come up with a solution for this maybe keep that in mind so that i can discuss how to impliment it in the code.
thanks guys.
View 5 Replies
View Related
Dec 5, 2007
i am putting together an application for a client of mine that involves image heavy data handling. i have a couple of possible methods in mind of how to go about this, and would like some outside opinions, especially from any of you who may have done anything similar before.
to quickly sum up the application's desired results: a photo gallery that contains four sections of job before/after photos. 1)residential 2)comercial 3) automotive and 4)specialty. when a site browser clicks a section, it will bring up a gridview of the "key" or ideal photo (one each)from several different jobs. the site browser can then click the photo, and a new page (or new control, does'nt make much difference) will come up showing all photos for that particular job.) past and current customers will create user logins to have ability to upload photos of their specific job. admin needs ability to 1)upload photos for many jobs 2)review all photos before posting them to the gallery 3) would like to give admin ability to order the photos within the gallery and within each job 4)admin needs ability to create tagline with short description either for each photo or at least for each job.
as to the design of the data, i can either store the images themselves in the database, or create tables to tag the images with various identifying data, then simple store and call the images in a directory on the server. i have code to do either. i am trying to construct a database design to handle all issues. i like the idea of storing photos in the database more, just not sure how to architect it. it would be the 4 albums, each with infinitely create-able 'job' albums within, each job album housing job photos.
i am thinking the images maybe get a table for their specific info (ID as primary key, image itself, file type, length, and a foriegn key to a job table that has jobID primary key) the job table could have a job name that user inputs, thus identifying all photos to the same job. the job table would also foriegn key to the album table id, with its four categories of residential, automotive, commercial, and specialty. does this method seem feasible? if this system seems workable, i can throw in a boolean default to false for the admin to set true to display the job photos as a whole, with admin power to delete photos on an individual basis. but i am a little stumped how he can maybe order them? maybe an int field that he can edit and just manually put the jobs in the order he wants? and then put the photos under the jobs in the order he wants as well?
it seems i have somewhat thought this out just now while writing, so it seems i have a somewhat workable solution, if awkward, but if anybody knows a simpler, or tried and true, method, please let me know
any ideas, suggestions, and help is greatly appreciated.
View 23 Replies
View Related
Jan 2, 2008
Hi all
I am more of a front end UI developer but have been tasked with building a project from scratch - here is my question.
I need to store information on Cases (e.g. Helpdesk calls/Customer Complaints etc...) and then against each Case and number of Activities. This is what I have come up with:
2 Tables (Case and Activity)
View 3 Replies
View Related
Feb 13, 2008
I have a question regarding table design (I'm using SQL Server Express 2005). Is it better and is there a performance gain by using layout # 2 instead of layout # 1? Someone told me it was better to divide everything up but it seems kind of useless here, plus it complicates the handling. So I want to know which one is faster (or better) considering large amount of records. Thanks! Layout # 1Objet==========ObjetIDClientIDObjetTypeStateObjetNoTitleDescriptionStartDateReturnDateEndDateLayout # 2
Objet==========ObjetIDClientIDObjetTypeStateDetailsObjet==========DetailIDObjetIDObjetNoTitleDescriptionStartDateReturnDateEndDate
View 3 Replies
View Related
Mar 4, 2008
Hi there everyone,
I am starting to develop a new internal website for my company, for logging calls, reports and billings. I am still busy looking at the best way to design the layout of the DB.
My biggest concern is a billings table design. What it should do is, that when work was completed, the consultant must add his billings to the logged call. My problem is that i will never know how many individual items will be billed for. I was thinking of just creating a table with [id, call_id, item_1, cost_1, quan_1, item_2, cost_2, quan_2, item_3, cost_3, quan_3...........] but i think (hope) that there must be a better way of doing this.
RegardsJacques Thomas
View 3 Replies
View Related
May 28, 2008
If i have a "VarChar" field in a database and it is set to something like 500 chars for each entry - if that field is not filled with data, or if it is only filled with a small amount of data (i.e. only 3 chars of the 500) is space allocated each time for the full 500 chars or does "VarChar" only use up the number of chars entered for the row - and if nothing is entered does it use up no space (in that field)?I'm trying to decide if i need to design my table structure in such a way that it does not waste space as i have a field that "once in a while" something could be entered but not very often.
View 1 Replies
View Related
Mar 10, 2004
Hello, could someone pls help me with this table design.
I have a project table and a code table. The code table has things like priorities (High, Medium, Low).
Now, I want all projects to be able to use these 'global' codes as well as define their own. So, they could define their own priority code 'Critical', that only their project can see.
Any help would be great.
View 1 Replies
View Related
Mar 16, 2004
Hello,
I have a question on how best to set up my tables for a project. Here's the details...
I am creating a Tasks List us ASP.NET w/ VB. I currently have only two tables..
Tasks
... TaskID - int ID Column
... Title - varchar to Store Task Title
... Building - int 0,1,2,3 Each # Representing a Building
... Details - varchar Store Details about Task
... Status - int 0,1,2 (Not Started, In Progress, Complete)
... DateDue - datetime Stores Date Task is Due
... DateCreated - datetime (getdate() on insert)
... Priority - int 0,1,2 (Low, Med, High)
... AssignedTo - int Stores ID of Person Responsible
Tasks Users
... UserID - int ID Column
... UserName - varchar Stores Name of Users
... Role - int 0,1,2,3,4 (Used to Filter Users by Department)
I'm having to do lots of conversions for Building, Status, Priority, and AssignedTo. Should I be storing these values in the Tasks table, or should I set up additional tables to use as lookups? Any input on how to improve my current design would be apprieciated.
Thanks,
Jim
View 2 Replies
View Related