In which subject area transactions are not needed? - database

It's just a question from interview. I can't find an answer. The first part of the question is "what is a transaction and what is it for" - it's not a problem to answer.
More exactly - "give an example of the subject area where transactions are not needed".

Related

Efficient algorithm for searching in database

I am working on a new project where I have 500k questions to be stored in database. Each time a student answers a question, that ques is marked under visited category for that specific user. Thus, what a student should see on main page is question that he has never visited. So, my problem is that if 10 questions are posted on the main page, then each question will have to be first matched with collection of the visited question, check whether they are in the list of visited question for that user and then get posted on the main page. How should I minimize the time required for such kind of requirement? or Is my algorithm inefficient?

Database Design for Conditional Questionnaire

I am designing a database schema to support a business case in which a user can submit a request (for him/herself or on someone else's behalf). To process and complete the request, the submitter will be prompted with questions based on their answers to prior questions. That is to say, the next question is conditional based on the current question's answer.
Each question will have an associated type, which will drive the user form for that particular question. A question of type boolean indicates Yes/No radio buttons for the answer. Questions of type multiple indicates a multiple choice answer, where users will select one of multiple radio options.
I have two questions:
How can I modify my schema to "link" answers to multiple choice questions? (ie "the following answers are available for question X.")
How should the answers drive the next question? (ie. "for question #1, if answer A is chosen, then GOTO question 5")
My question_relationships table will let me specify that question 1 is the parent of question 5, and question 5 is the parent of question 6. But I really need the answers to drive this logic.
question
-id
-question_name
-question_text
-question_hint
-question_type (boolean, multiple)
question_relationship
-id
-fk_parent_question_id
-fk_child_question_id
request
-id
-person_id
-submitter_id
-submit_date
-status
request_answer
-id
-fk_request_id
-fk_question_id
-answer_text
-answer_boolean
I have seen the answers in db design - survey/quiz with questions and answers, but I believe that my scenario is a bit different.
A table has an associated fill-in-the-(named-)blanks statement aka predicate. Rows that make it into a true statement go in the table. Rows that make it into a false statement stay out. That's how we interpret a table (base, view or query) and update a base. Each table represents an application relationship.
(So your predicate-style quote for 2 is how to give a table's meaning. Because then JOIN's meaning is the AND of argument meanings, and UNION the OR, EXCEPT is the AND NOT, etc.)
How can I modify my schema to "link" answers to multiple choice
questions? (ie "the following answers are available for question X.")
// question [question_id] has available answer [answer_id]
question_answers(question_id, answerid)
How should the answers drive the next question?
(ie. "for question #1, if answer A is chosen, then GOTO question 5")
// for question [this_id] if answer [answer_id] is chosen then go to question [next_id]
next_question(this_id, answer_id, next_id)
PS
There are many different ways of representing graphs (nodes with edges between them) via tables. Here the nodes are questions and the edges are this-next question pairs. Different tables support different kinds of graphs and different patterns of reading and update. (I chose one reflecting your application, but framed my answer to help you find your best representation via proper design yourself.)
PPS
If different user traces through questions can mean that which question follows another is context-dependent:
// in context [this_id] if answer [answer_id] is chosen then go to context[next_id]
next_context(this_id, answer_id, next_id)
What a "context" is depends on aspects of your application that you have not given. What you have given suggests that your only notion of context is the current question. Also, depending on what a context contains, this table may need normalization. You might want independent notions of current context vs current question. (Topic: finite state machines.)

what should be database schema for online voting app

I want to develop an app where Events/Question would be posted by admin and user will vote or answer. Here question can be of three different type and each type can have different option.Admin can view reports about each question
E.g
WHQuestion: What is right age for marriage? (1) >20 (2)=20 (3)20<
Voting:Who is best captain (1)ABC (2)PQR n so on......
YesNoQuestion: Is Dhoni a good captain? (1)Yes (2)No
So I am confused here about the database schema and tables. How should i manage them?
All questions are multiple choice with one or zero correct answers. So: One question, some answers, one optional correct answer.
Question: question_no, text
Answer: question_no, answer_no, text
As to how to store which answer per question is correct, there are two options:
Store the answer_no in the question record. I consider this the better option. A dbms featuring deferred Constraints (so a question record can reference an answer record and vice versa) would be a good thing to have here. If there is no correct answer the answer_no is null.
Have a flag in the answers table and then mark one answer per question as correct and the others as incorrect. This would be appropriate if there were multiple correct answers per question possible. For one correct answer, however, this would be the worse option of the two. To guarantee data consistency you would apply some special check, which can be a bit complicated (for instance a function index to guarantee uniqueness). For no correct answer you could store the same value or even null for all answers. However, you must see the answers to find out that this is a vote question. So again, option 1 is the better choice where you see this immediately in the question record.

Logic for recommender application

I am developing an application - which would have users answer maybe 10 questions - which would have 3-4 options for each question. At the end of the 10th question, based on the responses, it would need to suggest a certain solution. Since there are 100's of permutation and combinations - what's the logic that would be required to use and the database design,
thanks
EDIT some more detailed explanation
if my application is used to recommend a data plan from various mobile operators - based on the user answering questions like the time spent on the internet, the type of files being downloaded and so on. So, if the response to question 1 was a and question 2 was c, etc - then it would be a certain plan. If the response to question 1 was b and for question 2 it was c, then it would recommend a certain plan. So, if there were 10 questions - then the combinations can be quite large. So is there a certain algorithm that can handle this?
I. what would be the logic?
If I understand correctly, you would define "rules" such as
If the answer to question 5. is either A or B then the suggested plan would be planB, otherwise execute the rest of the rules.
So you would use a rule engine e.g.: http://www.jboss.org/drools/
II. what would be the database design?
This is quite simple:
USERS table,
QUESTIONS table and
ANSWERS table which would refer to the two others
Possibly there would be a QUESTIONNAIRE table as well, and the QUESTIONS table would refer to it.
Just a 'quick' comment, consider letting the user see changes in what company they could be recommended as they answer every question.
For example, if I am most interested in price that would be the question I would answer first and immediately see the 3 cheapest plans/products recommended to me.
The second question could be coverage and if I then could see the 3 plans with best coverage (in my area) that would be interesting too.
When I answer the third question about smart phone features and I say I want internet, then the first question should spit out the 3 cheapest plans/products that include internet, obviously they could change.
And so on...
Maybe it also could be a good idea to let the user "dive into" each question and see the full range of options for that answer. As a user I would appreciate that.
Above comments is just how I would appreciate if a form was made for me, I don't want to answer 10 questions about stuff I'm not really putting any value on, each user is different and will prefer to make their choice on their questions.
So, based on above it would be like a check list where the top answers would be the plans/products with the most fitting check marks. And to give immediate responses (as the user answer/alter each question), here AJAX would probably be your choice.

Artificial Intelligence project idea [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am looking for a graduation project idea in AI and machine learning field...
The idea may require front-end user interface to attract users...
I am thinking of how AI and machine learning can help you in daily life..?
Any help/hint about new interesting ideas ?
Thanks
Edit:
I am talking about practical ideas that may be used in real life... Not an idea to prove theoretical things... Something like a OS (or an add on in existing one) that adapt with your way of work... or a word processor that helps you collecting information about what you are writing..
What about an project that uses Markov-Chain text generation to generate answers for Stack Overflow questions? (^__^)
Two ideas:
Write a current, robust version of SHRDLU with understandable source code.
Write a SHRDLU-like program that manipulates actual code instead of imaginary blocks. Such a tool could be used for manipulating extremely large, complicated programs, including its own code!
Imagine giving commands like the following...
(a) Scan web site X and list any sentences you failed to parse.
(b) Scan document Y and list any grammar rules you didn't need.
(c) Instead of iterating over every element of "proplist" in your "search" function, only process the cdr of "proplist" if the initial call to "lookup" returns nil. After you make the modification, confirm the sentence "pick up a very very big block" will succeed and the sentence "pick up a very and very big block" will fail.
(d) Your "conjoin" grammar currently requires a coordinator word like "and", but that requirement is wrong. Split your "coordination" grammar into "syndetic coordination" and "asyndetic coordination" as follows: conjoins using "and", as in "quickly and quietly, he walked into the bank" are called "syndetic coordinations". Conjoins without a coordinator, as in "quickly, quietly, he walked into the bank" are "asyndetic coordinations". Now scan corpus Z to see if fewer sentences fail to parse.
One component of intelligence is imagination.
It wouldn't take much to Google for "artificial intelligence research projects" and see what other people are doing at other schools. Since it's not a Ph.D., there's no uniqueness requirement for you.
You could also look at Peter Norvig's text to see what's been done before and adapt it.
I'd also recommend doing something with the reams of data that's available to you on the web. Try thinking about "Programming Collective Intelligence" and "Beautiful Data" to see how you could use information to teach a program how to adapt its behavior based on new information (neural nets, genetic algorithms, ant colony algorithms, etc.)
What interests you?
AI is used in a great many areas, so find something you are passionate about and then see how to use AI for it.
For example, if you are interested in games, then you could find an interesting algorithm for the ghosts in Pac-man to chase, and use some more interesting mazes. You may find someone that is interested in doing a 3D project and they could write a 3D version and your algorithm could be more interesting.
Or, you may be interested in robotics. Again, it would be ideal if you could find someone with an interest in making a robot and you could write the AI part. So, for example, you could see if you can figure out how to get a robot to determine the difference between a farm crop and a weed/grass.
Basically, your starting point should be on what really interests you.
Perform a clustering on documents, as done by ex-clusty search engine. This clearly is an attractive application.

Resources