473,320 Members | 1,713 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,320 software developers and data experts.

Database design/ query question

Lets say i have a database where users can upload their dvd collection.
I want to be able to do a query where i can select all the users who
have a certain DVD. Can someone point me in the right direction as how
to optimally do this?

Aug 6 '06 #1
3 2701
On Sun, 06 Aug 2006 07:24:08 -0700, ryan wrote:
Lets say i have a database where users can upload their dvd collection.
I want to be able to do a query where i can select all the users who
have a certain DVD. Can someone point me in the right direction as how
to optimally do this?
Why not:

SELECT user-name FROM dvd-table WHERE dvd-name = <search value>.

Based on the nature of your question I believe you are a "newbie" and I
suggest that you do some research about Relational Database Management
Systems. A good place to start is to ask the instructor at one of the
local colleges the name of the text they use for their basic database
management course.

If your local college doesn't offer such a course you can use the book I
used when I taught this course last year. Database Systems: Design,
Implementation, & Management by Peter Rob and Carlos Coronel. The
publisher is Thomson Course Technology. If you can't find it locally
it is available from Amazon.

HTH
Jerry

Aug 6 '06 #2
Maybe i didnt state my question clear enough. This is a hypothetical
situation, but what if i had thousands of users? Would i be forced to
store the user IDs of each person who owns that DVD in each DVD row?
This doesnt seem practical to me. I want the DVD table to act as a
library with length, year, etc, and i dont want users to be included in
it.

Aug 6 '06 #3
On Sun, 06 Aug 2006 14:45:13 -0700, ryan wrote:
Maybe i didnt state my question clear enough. This is a hypothetical
situation, but what if i had thousands of users? Would i be forced to
store the user IDs of each person who owns that DVD in each DVD row?
This doesnt seem practical to me. I want the DVD table to act as a
library with length, year, etc, and i dont want users to be included in
it.
Ah!

What you need is a third table. The table will consist of one row for
each DVD owned by each user. Each row will contain two columns, the first
being the primary key from the user table and the second being the primary
key from the DVD table. So if user a has 10 DVDs there will be 10 rows
for user x in this table.

You can wind up with a lot of rows in this table, but each row doesn't
take up very much space and, these days, disk space is very inexpensive.
HTH
Jerry
Aug 6 '06 #4

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

Similar topics

0
by: Lefevre, Steven | last post by:
Hey folks - Thanks to everyone who gave input to my concerns. Of course, we don't intend to have the mysql port open to the world. We will have Apache/PHP connect on a unix socket, or to another...
7
by: Foxster | last post by:
in access i have two tables (tblplayer, tblpoints) in tblplayer i have field totalpoint (number) in tlbpoints i have field pointgame (number) the two files are related via idplayer now i made a...
7
by: Danny J. Lesandrini | last post by:
I know this has been discussed before, as I've seen the Google posts, but they all leave me with an unanswered question: Does my DAO code executed in the front end cause the back end to bloat?...
6
by: Noozer | last post by:
I'm developing a database using MS Access and have come across a problem. The majority of my database is pretty straightforward "many to one" relationships. I have one relationship that is...
5
by: William Wisnieski | last post by:
Hello Everyone, I'm really stuck on how to design this application, so I thought I'd see if anyone had any general ideas on how to proceed. I'd say I'm an intermediate level Access developer. ...
4
by: Smriti Dev | last post by:
Hi There, I'm creating a MS ACCESS database using Ms Access 2000 to store Interpretation requests by different departments in a hospital and Interpreter availability. All internal departments...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
10
by: Jim Devenish | last post by:
I have a split front end/back end system. However I create a number of local tables to carry out certain operations. There is a tendency for the front end to bloat so I have set 'compact on...
12
by: nyathancha | last post by:
Hi, I have a question regarding best practices in database design. In a relational database, is it wise/necessary to sometimes create tables that are not related to other tables through a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.