Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: Question relations tables
Felix Windt
10/3/2007 11:05:00 AM
> -----Original Message-----
> From: list-bounce@example.com
> [mailto:list-bounce@example.com] On Behalf Of Remco Swoany
> Sent: Wednesday, October 03, 2007 3:38 AM
> To: ruby-talk ML
> Subject: Question relations tables
>
> hi,
>
>
> I have a user-table described as below. That is filled in trough the
> sign-in form and available through the edit-method.
>
> Field | Type | Null | Key | Default | Extra
> |
> +-----------------+--------------+------+-----+---------+-----
> -----------+
> | id | int(11) | NO | PRI | NULL |
> auto_increment |
> | username | varchar(64) | NO | MUL | |
> |
> | email | varchar(128) | NO | | |
> |
> | hashed_password | varchar(64) | YES | | NULL |
> |
> | enabled | tinyint(1) | NO | | 1 |
> |
> | profile | text | YES | | NULL |
> |
> | created_at | datetime | YES | | NULL |
> |
> | updated_at | datetime | YES | | NULL |
> |
> | last_login_at | datetime | YES | | NULL |
> |
> | |
> +-----------------+--------------+------+-----+---------+-----
> -----------+
>
> Now i want also that the user can fill in the following things:
>
> a)work experience
> b)studies
> ect.
>
> Must i add a new column in the user-table or make a new table and join
> it into the user table?
>
> If you recommended a second table, what is the process to do that?
>
>
>
> Grtz..remco
> --
> Posted via
http://www.ruby-...
.
>
The answer depends on in what form that data is captured. If you're
capturing a single value (such as the amount of years for work experience,
or a single subject as a major for college/university degrees), you can
probably get away with just adding more columns.
If you're capturing past employers with years worked there and the
addresses, and a list of programming languages an individual is proficient
in, it might make more sense to make more tables and link back to the
individual via its id.
That database layout looks like MySQL, so I'll assume you're using that. To
add a table, you can either simply open a command line tool session to the
database, logging in as a user that has sufficient rights to create tables.
Then simply run:
create table workexperience(<table description>);
You can also use GUI oriented tools, such as MySQL Administrator (available
for free from the MySQL website), or phpMyAdmin, a php frontend to MySQL
databases. Lastly, if you're using Rails, look into database migrations.
HTH,
Felix
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Question relations tables
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password