Theatre Seats database schema - database-schema

Hello!
I'm currently working on a theatre seat reserving prototype, and I wasn't too sure how to format the database.
The prototype has to call the database to get what seats are taken and what positions are empty.
There are 499 seats in the theatre. Would having 499+ columns in one table and then have to hardcode calling all 499+ columns be the best way to do this?

Related

Displaying different sheets at user's demand in a single dashboard -- Tableau

I am new to Tableau. I am not sure if I can use Tableau to create the following type of interactive dashboard.
Say I have two almost irrelevant data sources. The first one contains daily revenue for some department stores.
Store Name Date Revenue
-----------------------------
Macy 6/29/16 50,000
Century 21 6/29/16 46,000
Macy 6/28/16 45,000
Century 21 6/28/16 48,000
...
I want to use line chart to study the Revenue. So I would use Date as the horizontal axis, and Revenue as the measure, while using Store Name as the color dimension. As a result, it will render several color lines to capture the revenue in terms of date.
For my other data source, it contains similar things. But instead of doing department stores, it contains information about fast food chain restaurants.
Restaurant Date Revenue
----------------------------
KFC 5/1/16 50,000
McDonald 5/1/16 46,000
KFC 5/2/16 45,000
McDonald 5/2/16 48,000
...
I use line chart to study the revenue again.
Now with the dashboard, is there any way I can have a control with menu Fast Food and Department Store, so that if the user clicks Fast Food, the line chart involving Fast Food appears and if the user clicks Department Store, the line chart involving Department Store appears?
So far, I've been able to use this helpful article http://kb.tableau.com/articles/knowledgebase/multiple-sources-one-worksheet to display Fast Food and Department Store at request. But if the user clicks Fast Food, he will get only one line, instead of multiple lines (one for each restaurant).
I hope I have described my problem clearly.
You can fairly easily do this using a parameter control and using it as a filter in your sheets.
First, create a parameter control "View Control":
Next, create a calculated field based on the parameter for each data source:
The calculation should match the data source ('Fast Food' for the fast food source, and so on)
Then place the calculated fields in the filter card and set to True. This should hide one of the sheets and show the other. They should never be shown or hidden at the same time.
Lastly, place both sheets and the parameter control onto a dashboard. It is best to place the two sheets within the same layout container. You should get the following result:
change parameter:

Erroneous duplicate rows in BIRT report

I have a problem with a BIRT report I'm working on where I have a nested table in the report. The outer table contains data to do with an item on an invoice, while the inner table contains stuff to do with price banding for labor charges. I've written a separate DataSet which gets the inner data, bound by parameters to data in the outer table. Now, when I preview the inner DataSet in BIRT using the defaults I've given it, it returns two rows of data for that bill number & item number - a normal rate & an overtime rate if you like. When I run the report in full over the same data, the outer table stuff is fine, but the inner table just repeats the same row over twice - it's just the first row repeating.
This is sorta what the table looks like in layout view:
Item Description Rate Quantity Item total
[item] [desc] [rate] [quantity] [total]
...where the price & quantity are in the inner table.
I'd have expected to see something like:
Item Description Rate Quantity Item Total
1 Callout $40 1 $40
2 Labor $30 4.5 $185
$50 1
but instead I get more like:
Item Description Rate Quantity Item Total
1 Callout $40 1 $40
2 Labor $30 4.5 $185
$30 4.5
...even though querying the database & previewing the inner data set based on the same input criteria show the expected result.
Has anyone else had experience like this? I have a hunch it's to do with bindings, but not sure what.
One way to get this behavior is by accidentally replacing a table-level binding with a column-level binding.
For example, define a table by dragging a data set into the report. Select the entire table (use the outline view, or select something in the table and then click on the "Table" button that pops up just below the grid.) Then go to the Binding tab. Note that the data set and column bindings are all filled in.
Now select just one field in the Detail row. On the Binding tab, note that the Data Set is blank, and no column binding is shown. Someone who is confused by this (as I was) might then edit the column's binding and specify the same Data Set that was used to create the table. If you do this you will only see a single value repeated in that column when you run the report. (I believe the overridden column is binding to a second instance of the data set, not the one the table is iterating over.)
Not sure your question can be answered withou looking at the data and the design. But it is important to note that the results you see in the dataset preview, and not neccisarly what you would see if the query was run fully. I have seen difference with 7 records returned. I thought as it was only 7 it would be the same on full run, but it's not. The preview is not just a top 500 query, it has some other (not sure what) filters also.
To problem solve if it is your query or your binding.
If you are using a SQL database. Run the SQL in a SSMS query and see if you get the same results you do when run in the innner table.
Altentively, create a new test report, copy over your dataset and use with a stand alone table.
I think I sorted it, & this is the most bizarre thing: On the child table I'd been deleting the header & footer row & just leaving the detail row in, in the layout view. Last thing today, just before I was going to go home, I tried again - deleted the table for about the 70th time that day, replaced it, re-did the parameter bindings all exactly as before, but this time I left the header row & footer intact. Clicked the preview tab, voila, all shows up correctly. So, since I didn't need the header or footer on the child table, I went into properties, clicked Hide this element, preview again - all good. No difference to the data bindings, no difference to mappings or anything else, no change to the data sets - the only difference was leaving the header & footer in place but hidden.
Contemplating making a bug report, tbh.

Using a query within a form - Microsoft access

Hi I have a form that has a text box in the header and when the user enters the farmer Code into the text box the relevant record is displayed.
I am using the following criteria in the query within my Form Cotton12:
Like [Forms]![Cotton12].[2012]
Now I have 2 tables Table Cotton12 and Table Cotton11. They contain a database of farmers, from the year 2012 and 2011. Sometimes the data is the same sometimes it is not. For example Farmers are given farmer codes, however due to incorrect capturing of data different farmers have been given different codes throught over the years.
What I would like to do is in the same form, have the user enter in a farmer code and data from the 2012 table come up and the data from 2011 table come up so they can be compared and if that code is not in one of the tables the fields relating to that table stay blank.
For E.g. the form might look like this.
2012
Farmer Name
Acreage
Yield Estimate
2011
Farmer Name
Acreage
Yield Estimate
Your help would be much appreciated.
There are 2 potential ways to do this.
The more complex way is to create 2 sub-forms, and link them both to the main form via Farmer Code.
The easier way would be to just use a Join query to bring in both 2011 and 2012 data into the query, and then filter the exact same way you're doing it now.
However, I agree with Hans Up that the data should really all be in one table and a FarmYear field should be added to differentiate.

Access Crosstab or Form based on 2 tables with dates

There are a few answers here already that have part answered my challenge in Access but not fully.
I have 2 tables that form the basis of my database: customers and items
I have a further 2 tables; one for order quantities against customers and items (orders_a), and one for forecast quantities against customers and items (forecast_a).
forecast_a and orders_a also have a date for each customer and item combination (basically there will be 12 dates only for the 12 months of the year - 01/01/12,01/02/12,01/03/12 etc.)
Because a user will want to manually forecast quantities for a full year for each customer and each item, if there were 2 customers and 2 items, the forecast_a table would contain 48 rows. 2 items x 2 customers = 4, 4 x 12 dates = 48. The same goes for the orders_a.
I know this is a slightly unusual set up but the user requires visibility of a full year.
My main challenge based on this is as follows:
A user will want to see a form with customers in the first column, items in the second and then (like a crosstab): Jan Forecast Qty, Jan Order Qty, Feb Forecast Qty, Feb Order Qty etc.
Therefore how would I create a crosstab to pull both these tables together, and how would I go about creating a form for data entry off the back of it?
I may well be constructing my database the wrong way but the fact that the user needs a 'grid' where every entry is manual means I can't just have a form that creates a record one at a time for orders or forecasts.
Thanks in advance!
Nick
The problem you have is that this is a task that is in essence a spreadsheet task. Accordingly it may be best handled in Excel. To achieve this create an Excel object, create a blank worksheet, populate it with the data, then have a button to suck it back into the database when the user has finished.

Database design challenge

I'm creating an virtual stamp card program for the iphone and have run into an issue with implementing my database. The program essentially has a main points system that can be utitlized through all merchants (sort've like air miles), but i also want to keep track of how many times you've been to EACH merchant
So far, i have created 3 main tables for users, merchants, and transactions.
1) Users table contains basic info like user_id and total points collected.
2) Merchants table contains info like merchant_id, location, total points given.
3) Transactions table simply creates a new row for every time someone checks into each merchant, and records date-stamp, user name, merchant name, and points awarded.
So the most basic way to deal with finding out how many times you've been to each merchant is to query the entire transaction table for both user and merchant, and this will give me a transaction history of how many times you've been to that specific merchant(which is perfect), but in the long run, i feel this will be horrible for performance.
The other straightforward, yet "dumb" method for implementing this, would be to create a column in the users table for EACH merchant, and keep the running totals there. This seems inappropriate, as I will be adding new merchants on a regular basis, and there would need to be new columns added to every user for every time this happens.
I've looked into one-to-many and many-to-many relationships for mySQL databases, but can't seem to come up with something very concrete, as i'm extremely new to web/PHP/mySQL development but i'm guessing this is what i'm looking for...
I've also thought of creating a special transaction table for each user, which will have a column for merchant and another for the # of times visited. Again, not sure if this is the most efficient implementation.
Can someone point me in the right direction?
You're doing the right thing in the sense of thinking up the different options, and weighing up the good and bad for each.
Personally, I'd go with a MerchantCounter table which joins on your Merchant table by id_merchant (for example) and which you keep up-to-date explicitly.
Over time it does not get slower (unlike an activity-search), and does not take up lots of space.
Edit: based on your comment, Janan, no I would use a single MerchantCounter table. So you've got your Merchant table:
id_merchant nm_merchant
12 Jim
15 Tom
17 Wilbur
You would add a single additional table, MerchantCounter (edited to show how to tally totals for individual users):
id_merchant id_user num_visits
12 101 3
12 102 8
15 101 6007
17 102 88
17 104 19
17 105 1
You can see how id_merchant links the table to the Merchant table, and id_user links to a further User table.