Dynadot โ€” .com Transfer

SQL Questions

Spaceship Spaceship
Watch
Hey everyone I posted in the break room about a opp. My boss presented me with and it involves learning SQL. I have been reading for a few days and its starting to sink in somewhat. But I have a few questions . Lets start by telling you what he wants me to do.... and he told me yesterday i should be able to do it by tommorow (monday)

Accounting system
Set up a database on local comp.
Set up acual database
Select/insert/Update/Delete with joins

Transaction
TransactionID
AccountID
EntityID
TypeID
ClassificationID
Amount
DateWritten
DateCleared
CheckNumber

Account
AccountID
Name
StartDate
StartAmount

AccountStatement
AccountID
DateStart
DateEnd
Deposits
Withdrawals

Entity
EntityID
Name

Classification-For if it's and expense example"Expense-Employee" or "Deposit-MErchant Account"
ClassificationID
NAme

Type-Check/Credit Card
TypeID
Name

I have no problem setting up the Database in Enterprise manager. The tables are easy. were I am having problems in desiding what is a primary key and such. If I am reading correct a primary key is to distinguish unique info? Also I can figure out what the best way to join this all together.

Is there anyone out there that can help me on this one? Here is what I have so far.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Yes the primary key is used to distinguish each individual record in a table. It is good practise to have at least one primary key per table. When creating the joins the easiest kind is an equi-join where the primary key of one table maps directly to a field in another table. For example you could join the tables Account and Transaction by linking the AccountID in transaction to the AccountID in Account using something like this:

SELECT* FROM Account,Transaction
WHERE Account.AccountID = Transaction.AccountID
 
0
•••
OK so would both the AccountID fields need to be primary keys to join them? It seems to me there is alot that needs to be joined, but not much that needs to be unique
 
0
•••
no if possible Transaction.AccountID should be a foreign key (but depending on the database engine and version number it is not always possible, for example versions before mysql 5 did not support foreign keys).
 
0
•••
Yeah im pretty sure I wont be able to do this by tommorow..BLAH

Cant anyone just look at the diagram and tell me what I need to do?
 
0
•••
Anyone else?
 
0
•••
Do some research, I'm sure you'll figure it out.
 
0
•••
I do have another dumb question. I have sql enterprise manager set up on my home computer. is it possible to have more then one server setup? if so how do you do it?
 
0
•••
Dynadot โ€” .com TransferDynadot โ€” .com Transfer
Appraise.net
Domain Recover
DomainEasy โ€” Payment Flexibility
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back