473,402 Members | 2,046 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,402 software developers and data experts.

What is better to use?

I currently have two tables:
1: users
id_user
username

2: baned_users
id_user

i tought i could use something like this
1: users
id_user
username
is_baned

So would it be better to use two tables like in first example or one
table like in second example? Offcourse, not many users would be baned
(i hope). I currently have 59 joins with baned_users table in my
stored procedures, two of those are executed on every access to the
website (2xtop 20 users), what way should i use?

Sorry for my bad english.

Apr 16 '07 #1
4 1330
Think in Sets! A table can be a set of entities and that table must
have *all* for the attributes of that entity. I think you need an
"access_status" attribute in the Users table or you need a
relationship table that puts a user_id and a resource_id paired.
>Sorry for my bad English. <<
No problem. Please post DDL, so that people do not have to guess what
the keys, constraints, Declarative Referential Integrity, data types,
etc. in your schema are. Sample data is also a good idea, along with
clear specifications. It is very hard to debug code when you do not
let us see it.
Apr 16 '07 #2
Igor wrote:
I currently have two tables:
1: users
id_user
username

2: baned_users
id_user

i tought i could use something like this
1: users
id_user
username
is_baned

So would it be better to use two tables like in first example or one
table like in second example? Offcourse, not many users would be baned
(i hope). I currently have 59 joins with baned_users table in my
stored procedures, two of those are executed on every access to the
website (2xtop 20 users), what way should i use?
I recommend the second method (one table). Using a separate table
should be reserved for situations where a subset of users have
significant amounts of extra data (e.g. blobs for the top 20 users).
Apr 16 '07 #3
Igor (je*******@gmail.com) writes:
I currently have two tables:
1: users
id_user
username

2: baned_users
id_user

i tought i could use something like this
1: users
id_user
username
is_baned

So would it be better to use two tables like in first example or one
table like in second example? Offcourse, not many users would be baned
(i hope). I currently have 59 joins with baned_users table in my
stored procedures, two of those are executed on every access to the
website (2xtop 20 users), what way should i use?
The second design is the more natural design in my opinion. There could
be situations where the first design is better for performance, if you
often need to review the list of banned users, but that does not seem to
be a critical task in this case.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Apr 16 '07 #4
On Apr 17, 12:18 am, Erland Sommarskog <esq...@sommarskog.sewrote:
Igor (jerosi...@gmail.com) writes:
I currently have two tables:
1: users
id_user
username
2: baned_users
id_user
i tought i could use something like this
1: users
id_user
username
is_baned
So would it be better to use two tables like in first example or one
table like in second example? Offcourse, not many users would be baned
(i hope). I currently have 59 joins with baned_users table in my
stored procedures, two of those are executed on every access to the
website (2xtop 20 users), what way should i use?

The second design is the more natural design in my opinion. There could
be situations where the first design is better for performance, if you
often need to review the list of banned users, but that does not seem to
be a critical task in this case.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
OK thank you all, i think i'll go with the one table then.

Apr 17 '07 #5

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

Similar topics

52
by: Tony Marston | last post by:
Several months ago I started a thread with the title "What is/is not considered to be good OO programming" which started a long and interesting discussion. I have condensed the arguments into a...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
54
by: Brandon J. Van Every | last post by:
I'm realizing I didn't frame my question well. What's ***TOTALLY COMPELLING*** about Ruby over Python? What makes you jump up in your chair and scream "Wow! Ruby has *that*? That is SO...
226
by: Stephen C. Waterbury | last post by:
This seems like it ought to work, according to the description of reduce(), but it doesn't. Is this a bug, or am I missing something? Python 2.3.2 (#1, Oct 20 2003, 01:04:35) on linux2 Type...
2
by: Li Daobing | last post by:
Hello, Does anyone know what's the meaning of Dutch in "The Zen of Python"? Thanks in advance Li Daobing The Zen of Python, by Tim Peters
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
22
by: Alper AKCAYOZ | last post by:
Hello Esteemed Developers and Experts, I have been using Microsoft Visual C++ .NET for 1 year. During this time, I have searhed some topics over internets. Most of the topics about .NET is...
28
by: john_sips_tea | last post by:
Just tried Ruby over the past two days. I won't bore you with the reasons I didn't like it, however one thing really struck me about it that I think we (the Python community) can learn from. ...
19
by: Martin | last post by:
Hi all, We have an administrative application that we are considering to rewrite in aspx with vb2005. I think the marketing possibilities are enourmous. In our standard app, the user logs in...
49
by: Zach | last post by:
After having taken a looong break from VB (last used 6.0), I started getting back into programming again, this time with VS 2005. I began reading up on VB.NET from various sources (books,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.