Click here to Skip to main content
15,867,330 members
Home / Discussions / Database
   

Database

 
GeneralRe: JOIN vs. WHERE Pin
Jörgen Andersson12-Jul-14 20:44
professionalJörgen Andersson12-Jul-14 20:44 
GeneralRe: JOIN vs. WHERE Pin
Jörgen Andersson12-Jul-14 20:55
professionalJörgen Andersson12-Jul-14 20:55 
GeneralRe: JOIN vs. WHERE Pin
Klaus-Werner Konrad13-Jul-14 0:35
Klaus-Werner Konrad13-Jul-14 0:35 
GeneralRe: JOIN vs. WHERE Pin
Jörgen Andersson13-Jul-14 1:09
professionalJörgen Andersson13-Jul-14 1:09 
GeneralRe: JOIN vs. WHERE Pin
data modeling guy13-Jul-14 5:57
data modeling guy13-Jul-14 5:57 
GeneralRe: JOIN vs. WHERE Pin
Klaus-Werner Konrad13-Jul-14 1:08
Klaus-Werner Konrad13-Jul-14 1:08 
GeneralRe: JOIN vs. WHERE Pin
Jörgen Andersson13-Jul-14 1:46
professionalJörgen Andersson13-Jul-14 1:46 
QuestionHow to create an audit table? Pin
Bastien Vandamme10-Jul-14 0:30
Bastien Vandamme10-Jul-14 0:30 
Do you know if it exist a document or recommendation to create audit table or metadata elements on a database.

I ask this question because I just saw this :

SQL
CREATE TABLE client (
    id char(36)  NOT NULL,
    first_name varchar(255)  NOT NULL,
    last_name varchar(255)  NOT NULL,
    creation_date timestamp  NOT NULL,
    update_date timestamp  NOT NULL,
    CONSTRAINT client_pk PRIMARY KEY (id)
);


I don't like the idea to have metadata like creation_date and update_date in a business oriented table. Actually these two fields exists in all tables of this database.

What if I create a audit table like this:

SQL
CREATE TABLE audit (
    table_name char(32)  NOT NULL,
    fk char(36)  NOT NULL,
    update_date timestamp  NOT NULL
);


I don't need a creation date because the creation date is my first record with table_name and fk in this table. I could add a columns to add insert, update, delete information. With thi table I keep all my update dates and not only the last one.

Is this audit table a god practice ?
Can I also use this audit table to avoid conflict. You know when two users update the same record at the same time. It's possible to use the last update time to warn them there is a conflict.
AnswerRe: How to create an audit table? Pin
Eddy Vluggen10-Jul-14 8:14
professionalEddy Vluggen10-Jul-14 8:14 
AnswerRe: How to create an audit table? Pin
Mycroft Holmes10-Jul-14 14:15
professionalMycroft Holmes10-Jul-14 14:15 
GeneralRe: How to create an audit table? Pin
GuyThiebaut11-Jul-14 2:09
professionalGuyThiebaut11-Jul-14 2:09 
GeneralRe: How to create an audit table? Pin
Eddy Vluggen11-Jul-14 7:28
professionalEddy Vluggen11-Jul-14 7:28 
GeneralRe: How to create an audit table? Pin
jschell11-Jul-14 9:07
jschell11-Jul-14 9:07 
GeneralRe: How to create an audit table? Pin
Eddy Vluggen11-Jul-14 9:44
professionalEddy Vluggen11-Jul-14 9:44 
GeneralRe: How to create an audit table? Pin
Mycroft Holmes11-Jul-14 14:12
professionalMycroft Holmes11-Jul-14 14:12 
GeneralRe: How to create an audit table? Pin
jschell12-Jul-14 10:33
jschell12-Jul-14 10:33 
GeneralRe: How to create an audit table? Pin
Eddy Vluggen12-Jul-14 22:57
professionalEddy Vluggen12-Jul-14 22:57 
GeneralRe: How to create an audit table? Pin
jschell14-Jul-14 9:05
jschell14-Jul-14 9:05 
GeneralRe: How to create an audit table? Pin
jschell11-Jul-14 9:11
jschell11-Jul-14 9:11 
GeneralRe: How to create an audit table? Pin
Mycroft Holmes11-Jul-14 14:19
professionalMycroft Holmes11-Jul-14 14:19 
QuestionSQL Server Express Setup Command Line Problem Pin
Amr Muhammed9-Jul-14 11:25
Amr Muhammed9-Jul-14 11:25 
AnswerRe: SQL Server Express Setup Command Line Problem Pin
Bernhard Hiller9-Jul-14 21:11
Bernhard Hiller9-Jul-14 21:11 
GeneralRe: SQL Server Express Setup Command Line Problem Pin
Amr Muhammed11-Jul-14 3:28
Amr Muhammed11-Jul-14 3:28 
QuestionError converting data type varchar to numeric Pin
Maideen Abdul Kader5-Jul-14 19:42
Maideen Abdul Kader5-Jul-14 19:42 
AnswerRe: Error converting data type varchar to numeric Pin
Mycroft Holmes6-Jul-14 13:01
professionalMycroft Holmes6-Jul-14 13:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.