Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6529327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:37:23+00:00 2026-05-25T09:37:23+00:00

create table polls ( id integer not null auto_increment primary key, created datetime, modified

  • 0
create table polls (
  id integer not null auto_increment primary key, 
  created datetime, 
  modified datetime
);

create table quizzes (
  id integer not null auto_increment primary key,
  created datetime,
  modified datetime
);

create table questions (
  id integer not null auto_increment primary key,
  model varchar(255) not null, -- Poll or Quiz, in this scenario
  foreign_key integer not null,
  question varchar(255) not null,
  created datetime,
  modified datetime
);

create table answers (
  id integer not null auto_increment primary key,
  question_id integer not null,
  answer varchar(255) not null,
  created datetime,
  modified datetime
);

Can anyone make it more simpler(shorter) and meaningful than this for polls and quiz table ?

Here is another idea, which is better ? =>

| polls | CREATE TABLE `polls` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `question` varchar(300) NOT NULL,
  `mark` tinyint(4) NOT NULL,
  `created` datetime DEFAULT NULL,
  `modified` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |



| pollanswers | CREATE TABLE `pollanswers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `poll_id` int(11) NOT NULL,
  `answer` varchar(300) NOT NULL,
  `percentage` int(11) NOT NULL,
  `correct` tinyint(4) NOT NULL,
  `mark` tinyint(4) NOT NULL,
  `created` datetime DEFAULT NULL,
  `modified` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:37:24+00:00Added an answer on May 25, 2026 at 9:37 am

    Firstly, always name your tables in the singular. This is because a “table definition” is actually the definition for each row – one row (ie singular). Also, it reads more naturally: quiz.id makes sense – the id of the quiz, but quizzes.id is what? The id of the quizzes? No.

    To answer your question, you should definitely merge poll and quiz into one table. The tip off is they have the same definition. If you need to distinguish between the two, have a boolean column. Let’s call it quiz.

    You should also name your foreign keys as ‘table_id’, eg ‘quiz_id’.

    You should probably give a name to your quizzes.

    In mysql, the timestamp data type automatically updates whenever you change something in the row. It’s pretty handy – saves adding now() to every update/insert value set.

    IMHO your tables should be:

    create table quiz (
      id integer not null auto_increment primary key,
      created datetime,
      modified timestamp,
      name text,
      is_poll boolean not null default false
    );
    
    create table question (
      id integer not null auto_increment primary key,
      quiz_id integer not null references quiz,
      question varchar(255) not null,
      created datetime,
      modified timestamp
    );
    
    create table answer (
      id integer not null auto_increment primary key,
      question_id integer not null references question,
      answer varchar(255) not null,
      created datetime,
      modified timestamp
    );    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

CREATE TABLE Customer( customer_id INT NOT NULL, first_name VARCHAR(20), last_name VARCHAR(20), PRIMARY KEY (customer_id)
Here's my table: CREATE TABLE `alums_alumphoto` ( `id` int(11) NOT NULL auto_increment, `alum_id` int(11)
My table is: CREATE TABLE A( id serial NOT NULL, date timestamp without time
Given a table such as: CREATE TABLE dbo.MyTestData (testdata varchar(50) NOT NULL) ALTER TABLE
CREATE TABLE IF NOT EXISTS `mydb`.`MATCHES` ( `idMatch` INT NOT NULL , `idChampionship` INT
Sql: CREATE TABLE OldTable ( TaskId INT PRIMARY KEY IDENTITY, TaskName VARCHAR(32) ) CREATE
my table looks like this: create table foos( id uniqueidentifier primary KEY DEFAULT (newsequentialid()),
I have this table structure: CREATE TABLE users ( uid bigint NOT NULL, first_name
I have the following table structures CREATE TABLE [dbo].[WorkItem]( [WorkItemId] [int] IDENTITY(1,1) NOT NULL,
Given a table structure like this: CREATE TABLE `user` ( `id` int(10) unsigned NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.