I have an exam in some basic IT shit in a few hours. Never had classes in it, never even touched upon some of the subjects I am to cover -- I'm just taking the exam for the sake of it.
Databases is one of these things. Easy as fuck to learn on my own, but I have no time, so I seek your help.
Say I have 10 cabins that I rent out to niggerfaggots. What's the best way to record which dates each cabin is being rented? Do I create a separate table for each cabin or is there a quick, simple and more elegant, general way of doing this?
Also, how do I implement a form on a webpage allowing the user to pick a cabin and rent it from date A to date B, given that it's not occupied already?
Using MS Access for the databases and MS Expression Web for the shitty WYSIWYG HTML-shit. Never used either program before in my life.
Yes, create a separate table for each cabin with a column for the date and a column for if the cabin is booked on that date. Insert rows for every date from now up until a years time or something similarly far in the future, and every day run a process to append the next date onto the end of that table. Although, for efficiency you probably want to have a different table for each cabin and year too. When someone books a room, delete the row for that date and insert a new one with "BOOKED" in the other column. To determine if a cabin in booked for that date, use a loop to go through all the rows in the table checking for that date and if the other column says "BOOKED".
As for your web page, just use text boxes so the user can type in the cabin name and the date, and on the server side, construct your SQL statements from this data by adding strings together, e.g. SQL = "select * from cabin_"+CabinNumber+"_"+YearNumber. Though for added efficiency you might want to do this on the client in Javascript to avoid loading the server, then just pass the SQL statement in directly to the web server which passes it on neatly to the database.
That's the kind of thing you learn on the first day of a real class in databases... maybe even the first hour. You're not going to pass the exam if you don't even know that.
Don't take >>6's advice. He advocated the worst possible database and web development practices to make you look even more of an idiot than you already are.
Don't take >>20's advice. He advocated the worst possible database and web development practices to make you look even more of an idiot than you already are.