Tweet
This is the second part of the two parts article "Relational databases: some simple rules".
In the first part we have seen the ideas of tables and the way we can relate them.
And now... the conclusion!
Primary and foreign keys
We now need to move on a bit, but please keep in mind the example made in the first part of the article: two tables, with a relation for the state column.
The names table has the following columns: ID, name, surname, address, post code, city, state.
The states table has the following columns: ID, state.
In the persons table, the “state” column will contain only IDs related to the states table.
The ID column in the person table is a primary key. The ID in the state table is a primary key.
The “state” column in the persons table is a foreign key.
Quite easy, isn’t it?
Showing posts with label table. Show all posts
Showing posts with label table. Show all posts
Thursday, 28 March 2013
Tuesday, 26 March 2013
Relational databases: some simple rules (part 1)
Tweet
It doesn't matter what we prefer to use, either Ms Access or SQL Server or Oracle, or even MySql, but when we want to create a new database, we really need to consider its structure, plan it and finally create all the database elements.
To do such a thing might seem easy – and in general it is – but a good development plan is what we need to avoid pitfalls and future issues with the structure of the database. The complexity of a database is surely one of the things to be considered, in fact it is clear that a more complex database will surely be more complex to develop.
Some simple rules can be taken into account and in this two parts article we are going to see some important points we need to keep in mind when planning a new database.
It doesn't matter what we prefer to use, either Ms Access or SQL Server or Oracle, or even MySql, but when we want to create a new database, we really need to consider its structure, plan it and finally create all the database elements.
To do such a thing might seem easy – and in general it is – but a good development plan is what we need to avoid pitfalls and future issues with the structure of the database. The complexity of a database is surely one of the things to be considered, in fact it is clear that a more complex database will surely be more complex to develop.
Some simple rules can be taken into account and in this two parts article we are going to see some important points we need to keep in mind when planning a new database.
Friday, 27 May 2011
CSS: float!
Tweet
The float property is not really new. It has been used a lot, especially in blogs and online magazine. The most common use is when we need to put an image in a container and make the text surround it. Like this:
I believe you have seen the above effect everywhere. It is actually very easy to achieve and in this short article, we will see how to do it.
The float property is not really new. It has been used a lot, especially in blogs and online magazine. The most common use is when we need to put an image in a container and make the text surround it. Like this:
Lorem ipsum dolor sit amet, imperdiet in massa risus ultricies, nulla
neque commodo quisque, varius vitae odio, urna mi massa semper
pellentesque faucibus turpis, a sodales sit. Nullam ut dui tincidunt dui
sodales, et eget ultricies cras ac mauris, et in sollicitudin quis et
cum lacinia. Eget quis platea est pretium magna vitae, rhoncus luctus
nulla vehicula pretium explicabo, turpis placerat. In ut posuere magna
tortor non architecto, nisl cras eu lacus curabitur cras mauris.
pellentesque faucibus turpis, a sodales sit. Nullam ut dui tincidunt dui
sodales, et eget ultricies cras ac mauris, et in sollicitudin quis et
cum lacinia. Eget quis platea est pretium magna vitae, rhoncus luctus
nulla vehicula pretium explicabo, turpis placerat. In ut posuere magna
tortor non architecto, nisl cras eu lacus curabitur cras mauris. I believe you have seen the above effect everywhere. It is actually very easy to achieve and in this short article, we will see how to do it.
Monday, 18 April 2011
ASP: resulting recordset in two columns
Tweet
Today I am going to show you a little trick: how to display your recordset data in two columns. And to do so, we will use the MOD remainder function.
Let me make things more clear. We assume we are getting data from a database consisting in a single column recordset. Something like:
Regardless the number of rows, what we want is to display data the following way:
How do we do it? Believe me it is very simple.
Today I am going to show you a little trick: how to display your recordset data in two columns. And to do so, we will use the MOD remainder function.
Let me make things more clear. We assume we are getting data from a database consisting in a single column recordset. Something like:
| Name 1 |
| Name 2 |
| Name 3 |
| Name 4 |
| Name 5 |
Regardless the number of rows, what we want is to display data the following way:
| Name 1 | Name 2 |
| Name 3 | Name 4 |
| Name 5 |
How do we do it? Believe me it is very simple.
Subscribe to:
Posts (Atom)