Question about Microsoft Office Standard for PC

1 Answer

How many primary keys in MS.Access

Can there be two primary keys for a table?

Posted by ACCA_123 on

  • Anonymous Mar 09, 2009

    yhrt


×

Ad

1 Answer

Anonymous

  • Level 1:

    An expert who has achieved level 1.

    Problem Solver:

    An expert who has answered 5 questions.

  • Contributor
  • 5 Answers

No, there cannot be two primary keys in one table. You can specify more than one value to make up the primary key. For example, instead of just the last name column - you can have the last name and employee ID fields make up the primary key. If you don't specify a primary key, MS Access will usually ask you if you would like them to create it for you. You may be thinking about foreign keys. A table can have two or more primary keys in them but they would serve as foreign keys. For example - lets say you have table A with primary key "A" and table B with primary key "B". You can create table C and have both primary keys from tables A & B in it, however, they would be foreign keys in table C and not primary keys (they are only primary keys in their respective tables).

Posted on Oct 03, 2007

Ad

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

Having troube with my FOREIGN KEYs on two tables.


I suggest you visit this website you will get the solution, I tried and it worked.

http://bit.ly/1bUVmuW

Nov 25, 2013 | Computers & Internet

1 Answer

Update a record and save it in two or more tables.


First, make sure that the tables that you are using have some sort of Primary Key so that the correct records can be linked.

Next, choose 'Tools' -> 'Relationships' from the top menu.

Add the tables for which you want to link together. Drag the correct field from one table to the next table. A popup window should appear.

In the window that appears, choose the 'Enforce Referential Integrity' and 'Cascade Update Related Records' options.

Now, whenever you change the field in one of those tables, the corresponding filed in the other table should change as well.

Dec 11, 2012 | Microsoft Office Access 2003 (077-02871)...

1 Answer

Can u plz mail me tha easiest way to use Ms Access, like Creating relationship, with the table, creating form, query etc.


In general you initiate this process by pressing the "Relationships" button on the MS Access toolbar. It is the button with three small boxes arranged in a triangle shape.
rowell_randy_0.jpg

When it first comes up it will give you the option to add tables. You can add any set of tables including the possibility of adding one table more than once (you would do this if you wanted to create a relationship between fields in the same table).

Once you see the tables you're interested in, you simply drag the field from one table over a field in another table. The fields should be those that will define the relationship. Once done, you should see an Edit Relationships window. You can get back to the Edit Relationships window later by double clicking the line in the relationships window.
rowell_randy_1.jpg

MS Access does a good job of figuring out the relationship type. For example, if you match a field in one table, that is not a key, with a primary key in another table, Access will make this a Many-to-One relationship.

This can become a very deep subject. Hope this at least gets you in the right direction.

Dec 18, 2010 | Microsoft Computers & Internet

1 Answer

Application and example of relationship in access


Relationships

After you've set up multiple tables in your Microsoft Access database, you need a way of telling Access how to bring that information back together again. The first step in this process is to define relationships between your tables. After you've done that, you can create queries, forms, and reports to display information from several tables at once.

A relationship works by matching data in key fields - usually a field with the same name in both tables. In most cases, these matching fields are the primary key from one table, which provides a unique identifier for each record, and a foreign key in the other table. For example, teachers can be associated with the students they're responsible for by creating a relationship between the teacher's table and the student's table using the TeacherID fields.

Having met the criteria above, follow these steps for creating relationships between tables.
  1. In the database window view, at the top, click on Tools ---> Relationships
  2. Select the Tables you want to link together, by clicking on them and selecting the Add Button
  3. Drag the primary key of the Parent table (Teacher in this case), and drop it into the same field in the Child table (Student in this case.)
    relationshipdrag.jpg
  4. Select Enforce Referential Integrity
    refintegrity.jpg
    • When the Cascade Update Related Fields check box is set, changing a primary key value in the primary table automatically updates the matching value in all related records.
    • When the Cascade Delete Related Records check box is set, deleting a record in the primary table deletes any related records in the related table
  5. Click Create and Save the Relationship

Apr 09, 2009 | Microsoft Computers & Internet

1 Answer

How to add more than one record in one row ?


You need to have two tables. One table for the reservation (each reervation having a primary key) and one table to store the people "linked" to that reservation. In the second table, each person will be on a row and one column in your second table would refer to the first (reservation) table in a one-to-many relationship. Read into database design and this will make sense. This can all be done in ADO.NET.

Dec 24, 2008 | Microsoft SQL Server 2005 Standard Edition

1 Answer

After installing DB2 query is not executing


could you check whether you are connected to the database, where you are trying to create table,

check the database list, then connect to the database you want then execute the table creation ddl,
if no db found then create a database then proceed.

Dec 05, 2008 | IBM DB2 Connect Enterprise Edition for PC,...

5 Answers

Table Repair MySQL


MySQL offers Check Table syntax that checks a table or tables for errors. It works for several storage engines like MyISAM, InnoDB, & Archive. If you run this syntax then you can the cause of problem & reported tables.

If Check Table finds errors then you can repair reported tables by Repair MySQL Table syntax.

Aug 06, 2008 | Sun MySQL

1 Answer

MySQL data types


These are the types i know

1.VARCHARs with length less than 4 become CHARs
2.CHARs with length more than 3 become VARCHARs.
3.NOT NULL gets added to the columns declared as PRIMARY KEYs
4.Default values such as NULL are specified for each column

If there are more i'm sure folks around here will post them.

Aug 05, 2008 | Sun MySQL

1 Answer

MySQL Auto Increase


Try this -


CREATE TABLE users (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
login TEXT NOT NULL,
password TEXT NOT NULL,
PRIMARY KEY( id )
);

INSERT INTO users VALUES ( null, 'bob', 'mypassword' );
INSERT INTO users VALUES ( null, 'bill', 'pass' );
INSERT INTO users VALUES ( null, 'sean', '1234' );

Aug 04, 2008 | Sun MySQL

1 Answer

Connectivity


CREATE TABLE users (ID MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY, username VARCHAR(60), password VARCHAR(60


Registration


<?php
// Connects to your Database
mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error());
mysql_select_db("Database_Name") or die(mysql_error());

//This code runs if the form has been submitted
if (isset($_POST['submit'])) {

//This makes sure they did not leave any fields blank
if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) {
die('You did not complete all of the required fields');
}

// checks if the username is in use
if (!get_magic_quotes_gpc()) {
$_POST['username'] = addslashes($_POST['username']);
}
$usercheck = $_POST['username'];
$check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'")
or die(mysql_error());
$check2 = mysql_num_rows($check);

//if the name exists it gives an error
if ($check2 != 0) {
die('Sorry, the username '.$_POST['username'].' is already in use.');
}

// this makes sure both passwords entered match
if ($_POST['pass'] != $_POST['pass2']) {
die('Your passwords did not match.');
}

// here we encrypt the password and add slashes if needed
$_POST['pass'] = md5($_POST['pass']);
if (!get_magic_quotes_gpc()) {
$_POST['pass'] = addslashes($_POST['pass']);
$_POST['username'] = addslashes($_POST['username']);
}

// now we insert it into the database
$insert = "INSERT INTO users (username, password)
VALUES ('".$_POST['username']."', '".$_POST['pass']."')";
$add_member = mysql_query($insert);
?>

Sep 14, 2007 | Macromedia Dreamweaver MX 2004

Not finding what you are looking for?
Microsoft Office Standard for PC Logo

Related Topics:

479 people viewed this question

Ask a Question

Usually answered in minutes!

Top Microsoft Computers & Internet Experts

Ekse

Level 3 Expert

13434 Answers

Lee Hodgson
Lee Hodgson

Level 3 Expert

4810 Answers

efs_perpends
efs_perpends

Level 3 Expert

1997 Answers

Are you a Microsoft Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...