Primary keys Questions

1

How do I use primary keys in SQL server?
I have a table called course,and course_id is primary key in this table. I created another table subject.I mapped these 2 tables by course_id as foreign key,I  created another table teacher,i want to map this with subject, only subject_id to teacher_id mapping is required,how i mapp this,can i use course_id?  

Answer Question   |  September 9, 2010  7:03 AM
Primary keys, SQL, SQL Server, SQL tables
asked by:
75 pts.

ORA-01031 Insufficient privileges
I am trying to generate FK on table in schema A, which is the reference of PK on another table in schema B. The owner of schema A is also a DBA. It gives an error ORA-01031 Insufficient privillages

Answer Question   |  June 16, 2009  6:51 AM
Foreign keys, ORA-01031, Oracle development, Oracle error messages, Oracle foreign keys, Oracle primary keys, Primary keys
asked by:
5 pts.

A report that works in Crystal Reports client does not work in CMC
Oracle10g / Crystal Reports XIR2 / Central Management Console (CMC) Our Crystal Report fetches the last one week’s data from a big table. This report runs weekly, once. To tune this report, we created another table to maintain the primary key value(numeric sequence), of the latest viewed record. Through a stored procedure, we fetch this [...]

Answer Question   |  May 4, 2009  9:33 AM
Central Management Console, Crystal Reports XI, Oracle 10g, Primary keys
asked by:
5 pts.

Plausability of natural key as primary key
If you have a field in a table that is a natural key and meets all the criteria for a Primary key, is it advisable to use that natural key as your Primary? Or is it a better idea to assign a surrogate key (i.e. autonumber for TrainingProgramID instead of using TrainingProgramName)? Thanks in advance [...]

Answer Question   |  March 31, 2009  12:08 PM
Natural Keys, Primary keys, Surrogate Keys
asked by:
25 pts.

Microsoft Access linking
Hi, I have a database in access which has a main table and a products table. They are linked by a customer I.D. field (Primary Key). I have 2 forms one is the customer form and one a products form there is a button to open the products form from the customer form. I would [...]

Answer Question   |  February 26, 2009  10:40 PM
Database programming, Microsoft Access, Microsoft Access forms, Primary keys
asked by:
25 pts.

Adding an index on fields in a SQL Server table
I have a massive customer table. The ID is the primary key and thus SQL Server makes a clustered index on that. There is no other index on the table. Can I add an index on fields like age, country and gender to make the results faster?

Answer Question   |  January 15, 2009  5:18 PM
Primary keys, SQL Server index strategy, SQL Server tables
2,585 pts.

designing indexes
I have a question regarding database design. Lets assume that there is a table with 10 columns. I don’t have any single column which I can choose as candidate for Primary key. Though, combination of 5 columns can uniquely identify records. Here, I created an identity column as a PK and added UNIQUE constraint on [...]

Answer Question   |  October 14, 2008  3:31 PM
Database design, Indexes, JOIN statement, Primary keys
asked by:
25 pts.

Writing a specific query involving primary keys in SQL
I need to write a query in SQL that will get the fifth-from-last record from my database when either a primary key is defined or no primary at all is defined. How would this query look?

Answer Question   |  September 16, 2008  5:51 PM
Primary keys, Query, SQL, SQL Query
2,585 pts.

Overlapping data on a merge replication between three SQL Servers
We have a merge replication between our three SQL servers at three different locations. One is the publisher and two are subscribers, and we have a primary key on a table (a unique field with is auto-incremental by one). On the publisher’s server, if the user creates a new order, the table assigns it a [...]

Answer Question   |  August 19, 2008  8:04 PM
Merge replication, Primary keys
2,585 pts.

Error In SQL SERVER DataBase
am trying to insert four varchar(50) values in a table which is with a primarykey column id_number. i didnt check : “True” to the null field . so it should not allow null values in table. but while am trying . it allows null values. including primary key column. how is possible ? pls help [...]

Answer Question   |  July 28, 2008  9:41 AM
Database programming, NULL values, Primary keys, SQL Server errors, VARCHAR, Visual Studio, Visual Studio 2008
asked by:
5 pts.

Including a primary key in a nonclustered index in SQL Server 2005
The query optimizer for SQL Server 2005 is suggesting that we include a primary key as part of a nonclustered index. Is it OK to include that to increase SQL performance?

Answer Question   |  July 2, 2008  5:36 PM
Index, Primary keys, SQL performance, SQL Server 2005
2,585 pts.

Oracle Application Express Item
I have two tables with parent-child relationship. Is there a way to automatically populate the foreign key field of the child table with the exact data from the primary key of the parent table?

Answer Question   |  April 9, 2008  1:04 PM
Database, Foreign keys, Oracle, Primary keys
asked by:
Rwy
265 pts.

1