|
KORCARI wrote:
Can anyone show me any tricks about this ?
There are no tricks to normalisation.
IIRC, 1st normal form is to ensure that each column represents one distinct piece of data. e.g. If you currently have a Name column which contains, for example, Colin Mackay, that should be split into a Forename and Surname - "Colin" and "Mackay" (you may also want a middle name, and perhaps an additional surname (e.g. Spanish people have two surnames), title, and suffixes - it depends on what you want to do).
2nd Normal form is to ensure that each table has a primary key. This is normally a single column, but you can have compound primary keys with more than one column. A primary key must be unique. So, a person's name is not valid, but their National Insurance number is (or SSN, or a UserID, or whatever). Often you will have to create some sort of scheme to generate a unique value - most databases offer this facility.
3rd Normal form is to ensure that only data directly related to the primary key is stored in the table. So, for instance, if you were designing an application that held an electoral role that had each registered voter and their address in the database. You would split off the address into a separate table because it isn't directly related to the person (there may be more than one person living at the address). Now you have two tables, the person table will also have a foreign key (which is a copy of the primary key value for the address in the Address table).
Does this help? If you are still having problems perhaps you can post some details about your data and we can point you in the right direction using something you are familiar with. I know that when I first learned about normalisation I didn't get it the first time because the examples were all arbitrary. It was only when I had a real problem to solve that I started to understand what it was all about.
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Hey Colin, do you know about 4th and 5th Normal form?
I remembered learning them back in uni but they don't teach 'em anymore nowadays. I knew as I just taught my friend at uni about this and the examples are TERRIBLE.
Edbert P.
Sydney, Australia.
|
|
|
|
|
|
Here's what I know about 1st to 3rd NF:
1st NF: No repetition.
Make sure there are no repetition of data or multivalue in single column (e.g. 2 phone numbers in one column "9999 9998, 9999 9999"). That means you may have to split the table into several tables until there is no repetition of data.
2nd NF: No partial dependency.
Check tables with compound PKs (PKs consist of 2 or more column). If there is a column that depends only on a part of the compound PK then you have to put it in a new table e.g. table with columns
StudentID, ClassID, Grade, StudentName
has to be separated into
StudentID, ClassID, Grade
StudentID, Student Name
as StudentName is only dependant on StudentID, not both StudentID and ClassID (the composite PK) hence the partial dependency.
3rd NF: No transitive dependency.
Check that there are no columns (including the PK) that is dependant on a non-PK column e.g. table with columns
EmployeeID, EmployeeName, ManagerID, ManagerName
has to be separated into
EmployeeID, EmployeeName, ManagerID
ManagerID, ManagerName
as ManagerName is dependant on ManagerID (non-PK) hence the transitive dependency.
Hope it helps!
Edbert P.
Sydney, Australia.
|
|
|
|
|
Actually, I've solved my prior problem, but what I can't seem to do is get one query that does everything I want. I have two queries, that return the same columns, but one returns where a primary org is set, and one returns an arbitrary org for the contact where there is no primary. How do I turn these two tables, with the same columns, into one ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Use UNION?
e.g.
SELECT Column1, Column2<br />
FROM qry1<br />
UNION<br />
SELECT Column1, Column2<br />
FROM qry2
Edbert P.
Sydney, Australia.
|
|
|
|
|
I've heard that I can use SQL to run dynamically changing mathematical equations. I've got the equation stored in a string (i.e. "((100-75)/100)*100") with the values randomly changing. the formula will not stay constant either, but it is the example I am using. How do I get this to produce a result that I can store in another string? Thanks.
Nick
|
|
|
|
|
ColdWaterBlue wrote:
I've heard that I can use SQL to run dynamically changing mathematical equations.
It has the potential. You could create some dynamic SQL and execute it.
EXEC ('insert the dynamic sql between the apostrophes')
The final solution depends on the source of the data (which table(s) in the database, and which columns) and how dynamic you want your forumulas. For instance, you could set up a table to hold the formulas.
You are probably looking at writing some stored procedures to do the properly.
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Hello All, I wrote the code below planning to use it to pick out the newest database log file in a certian directory on a computer on our LAN.
<br />
Function NewestFile(Directory, FileSpec)<br />
' Returns the name of the most recent file in a Directory<br />
' That matches the FileSpec (e.g., "*.xls").<br />
' Returns an empty string if the directory does not exist or<br />
' it contains no matching files<br />
Dim FileName As String<br />
Dim MostRecentFile As String<br />
Dim MostRecentDate As Date<br />
If Right(Directory, 1) <> "\" Then Directory = Directory & "\"<br />
FileName = Dir(Directory & FileSpec, 0)<br />
If FileName <> "" Then<br />
MostRecentFile = FileName<br />
MostRecentDate = FileDateTime(Directory & FileName)<br />
Do While FileName <> ""<br />
If FileDateTime(Directory & FileName) > MostRecentDate Then<br />
MostRecentFile = FileName<br />
MostRecentDate = FileDateTime(Directory & FileName)<br />
End If<br />
FileName = Dir<br />
Loop<br />
End If<br />
NewestFile = MostRecentFile<br />
<br />
End Function<br />
However, the directory that I need to pass to this function when called is a filepath on a computer on the LAN and the directory I need to access is password protected. Can anyone help me out on how to do authentication using VBA code in an access DB. Thanks is advance.
Frank
|
|
|
|
|
Hey guys...
I have a very simple question with probably a very difficult answer (for me )
I have a view, containing three fields I want to create a crosstab with.
A Date (should be the 'row' header)
A Name (should be the 'column' header)
and a Total (number) field.
Can anyone 'introduce' me into SQL, cause i'm very very very new into these kind of queries (probably SP's)
I love it when a plan comes together
|
|
|
|
|
Either install Reporting Service to SQL Server or endure the agony I had to by using the following techniques. Take a look at the following article which will do the cross tab queries. I implemented them with success.
http://www.sqlteam.com/item.asp?ItemID=2955[^]
Good Luck
Michael
I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious.
Vince Lombardi (1913-1970)
|
|
|
|
|
Does anyone know of any good ( and preferably free ) programs that will compare two instances of an Oracle db and generate an upgrade script of the differences including existing data?
|
|
|
|
|
Hi all,
For SQL2000 or SQL CE, if one record in the table is locked by a client
with SQL command, then if any other client access the locked record, will the SQL server return exception or the SQL server will let the client wait until the record is unlocked ?
Thanks
|
|
|
|
|
Is it possible work with ADO and MySql Database in VB6?
|
|
|
|
|
paykani wrote:
Is it possible work with ADO and MySql Database in VB6?
Yes, You need to get the ODBC drivers from the MySQL website. Once they are installed, Use ADO to connect via ODBC as the data source.
-----------------------------
Social Engineering Specialist.
Because there is no patch for human stupidity.
|
|
|
|
|
Hello!
I have a problem sorting columns (not rows!) in DataSet. Each column in my DataSet represents a month. I get a filled DataSet, but I want my columns to be sorted by months(january, february, march etc.) before I bind it to DataGrid. How can I sort them? Is it posible to sort columns in a DataGrid?
Thanks for the answers.
Jani
|
|
|
|
|
|
Yes, I have considered sorting columns this way, but it has no effect, because I have a query in a for loop, and query is different each time the loop iterates. So I fill DataSet each time I iterate through the loop. The result is unordered DataSet. So, I need ordered DataSet.
|
|
|
|
|
|
Hi
Is there any problem if 2 threads use the same database SQL Server CE 2000 connection do transaction at the same time?
If 1 threads capture the right to do the transaction, then is the other thread will wait for access or what others happen?
Thanks
|
|
|
|
|
I'm assuming that SQL Server CE 2000 is sufficiently similar to the full SQL Server 2000 product that this answer is valid - Considering you are using a cut down version I cannot see how it would have enhanced functionality. So here goes...
If you use 2 threads and operate on the same connection then you have to be careful only to run one command at a time on the connection. Remember that the DataReader is running the command until you exhaust the data being returned. If you attempt to run a second command at the same time as an existing command is running an exception will be thrown.
So, the answer is: It won't wait, it will throw an exception.
Do you want to know more?
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and Forums
|
|
|
|
|
Then how about 2 thread hold 2 objects respectively and the objects contains a database connection respectively and the 2 connections are different object reference but they also connect to the same database?
Will exception be thrown if the 1 object is doing transaction and the other object try to connect to the database?
|
|
|
|
|
|
Following a number of MSDE installations I am finding that whenever the client re-boots or shuts down the server / PC the server connection settings are lost and have to be manually re-entered to restart the server. Can anyone help with where this is controlled from?
I have a local installation from the Microsoft SQL Server Personal Edition CD and don't have this problem. I seems to be associated with the MSDE install.
Thanks,
Kerry Johnson
Business Systems Consultant
|
|
|
|
|