Brief: I’m fairly new to databases and currently have one with two tables for a checker type script. Is there a way to ensure that both tables use the same types of columns? This database is in Sybase.
Detail: The first table is basically a log of every check ever made by the script (Let’s say there are 106 checks in one run, so it would [No. of runs] x [No of checks <106>]). The second table is for the last run, so in this case, it would contain 106 rows. This is not a constant number however, and could increase.
My question is, is there a way to force both tables to have common columns? I see in the syscolumns table that there are a number of rows dedicated to each of these tables, but since they are the same, can I somehow have the tables pull their ‘style’ (is schema correct) parameters from the same source so any changes on one are made on the other?
Thanks!
One way to manage the relationship between multiple columns and datatypes is by using user defined domains. Some DBMS systems support user defined domains. Others don’t
The verb in SQL is “CREATE DOMAIN”. You can look up the specifics in your documentation.
Then, when you create tables, and you create the columns that make up tables, you use the domains you have created instead of specifying datatypes and related parameters. When two columns are referred to the same domain, they are guaranteed to have the same datatype. They are also guaranteed to have the same size, like the “7” in “char(7)”.
Creating domains in a way that really enhances your ability to simplify data management by abstraction involves both learning and experience. You have to start somewhere.