I'd like to use sheets like a database, the big question is how I can keep "foreign-key relationship" when removing or adding new entries in one tab?
An example:
Tab (aka "table") with basic personal information "people":
A | B | C | D
First | Last | E-Mail | Relevant
---------------------------------------------------------------
Peter | Parker | peter#parker.net | X
Steven | Mueller | steven.mueller#gmail.com |
Patricia | Doe | pat#pat.com | X
Based on column D ("Relevant"), I create a list of peoples first names in a second tab "info". Using:
=QUERY(people!A:D, "Select A where D='X'")
Which results in
A | B | C | D
First | | |
---------------------------------------------------------
Peter |
Patricia |
I am now adding more information (birth year and city):
A | B | C | D
First | Year | City |
---------------------------------------------------------
Peter | 1990 | New York
Patricia | 1980 | Boston
** so far, so good ** now the issue is, how can I preserve this data, if I add more entries to the "people" list? If I add an X for the person "Steven" in the "people" table:
A | B | C | D
First | Last | E-Mail | Relevant
---------------------------------------------------------------
Peter | Parker | peter#parker.net | X
Steven | Mueller | steven.mueller#gmail.com | X
Patricia | Doe | pat#pat.com | X
The table in the second tab will look like this - so Peter will "become" Patricia (pushing Patricia down).
A | B | C | D
First | Year | City |
---------------------------------------------------------
Peter | 1990 | New York
Steven | 1980 | Boston
Patricia
What is the best way to make this work?
you either need to introduce a system of IDs or have it sorted as it comes so every new entry will be always placed at the bottom. this way you won't disrupt the non-existent (manual) link.
Related
The table has following information
SchoolName | Medium | Board
------------+-----------+-------
DPS | English | CBSE
DPS | English | ICSE
St.Xavier | English | CBSE
St.Xavier | English | GSEB
Gurukul | English | GSEB
Gurukul | Hindi | GSEB
The above table is decomposed as:.
SchoolID | SchoolName
----------+-----------
1 | DPS
2 | St.Xavier
3 | Gurukul
MediumID | Medium
----------+-----------
1 | English
2 | Hindi
BoardID | Board
---------+-----------
1 | CBSE
2 | ICSE
3 | GSEB
And relationship as shown in below image.
Is the decomposition correct to store and retrieve the information?
Table and relationships as relational schema
Let's say I have a report with following table in the body:
ID | Name | FirstName | GivenCity | RecordedCity | IsCorrectCity
1 | Gates | Bill | London | New York | No
2 | McCain | John | Brussels | Brussels | Yes
3 | Bullock | Lili | London | London | Yes
4 | Bravo | Johnny | Paris | Las Vegas | No
The column IsCorrectCity Basically includes an expression that checkes GivenCity and RecordedCity and returns a No if different or a Yes when equal.
Is it possible to add a report filter on the column IsCorrectCity (and how) so the users will be able to just select all records with No or Yes? I know this can be done with a parameter in the SQL query, but I would like to add it based on the expressions rather then adding more calculations and all to the query.
Here's a tutorial which explains how you can do it
Filtering Data Without Changing Dataset [SSRS]
I need to reduce a model DB to 3NF. However there is a column in the data thats very ambiguous.
So the database has the following columns. (Apologies for formatting, I did try)
Employer ID | ContractNo | Hours | emp Name | workNo | workLocation
--
123 | A1 | 10 | J Smith | W36 | New York
124 | A1 | 7 | P Jones | W36 | New York
125 | A2 | 9 | R Lewis | W37 | Los Angeles
123 | A2 | 9 | J Smith | W37 | Los Angeles
Each employee has a unique ID, an employee can work at more than 1 location and each location has a unique workNo. I'm just a bit stuck on where to include the ContractNo. There is no indication in the question of what it actually is for.
So my first step was splitting it up into a table with EmployerID, employee Name and hours. And a second table with WorkNo, WorkLocation. But what do I make of that bloody ContractNo?
I expect the contract is likely a separate entity, capturing the nature of the relationship between contractor and contractee.
Image from QuickDBD, where I work.
So I have a database that is for selling products. The orders tables hold's the customer's order info like shipping province and Shipping method:
+--------------------+----+
| order | |
+--------------------+----+
| someOtherInfo | |
| shippingMethodID | fk |
| shippingProvinceID | fk |
| basePrice | |
+--------------------+----+
Basically what's happen now is we have a base price for shipping that's based on the Province and Shipping Method. I need to now add that base price for shipping to my orders table and the fact that base price for shipping is a Matrix table or 2d array where col(shipping Method) + Row(Province) = baseCost is throwing me off on how to implement it. I never had to deal with this so Don't even know what to look up.
Example of what the matrix looks like:
+--------+----+----+----+-----+
| | BC | AB | SK | etc |
+--------+----+----+----+-----+
| ground | 9 | 9 | 9 | |
| Air | 15 | 21 | 21 | |
| etc | | | | |
+--------+----+----+----+-----+
So I'm currently working on a stored procedure that returns a table comprising of data about the user (user ID) and performance metrics (field, metric_obtained). I was originally doing it so I would return all data back, but I was thinking it would be more efficient to return only people who meet the minimum to be recognized. I've already filtered them out based on minimum requirement, but the thing is they can be qualified based on a combination of things, so if I have 3 metrics A, B, and C, one recognition can be for A and B, or another is just C. I'm also not limited to a max of 3 or this wouldn't be a problem.
My tables look like this:
|Employee | Metric | Obtained|
|_________|________|_________|
| John | Email | .98 |
| Sue | Email | .99 |
| Sue | Phone | .82 |
| Larry | Email | .93 |
| Larry | Phone | .83 |
| Jess | Phone | .9 |
| Jess | Email | .94 |
| Bob | Phone | .99 |
So if I need to get back both Phone AND Email my results would look like this:
|Employee | Metric | Obtained|
|_________|________|_________|
| Sue | Email | .99 |
| Sue | Phone | .82 |
| Larry | Email | .93 |
| Larry | Phone | .83 |
| Jess | Phone | .9 |
| Jess | Email | .94 |
Like I said, this would be easy if I had a guaranteed number of metrics, but I don't. Any thoughts?