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 8350029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:11:11+00:00 2026-06-09T08:11:11+00:00

Task: At present, the database knows two types of messages: Messages that a user

  • 0

Task:

At present, the database knows two types of messages:

  1. Messages that a user posts and that are public for anyone and everyone to read
  2. Messages that a user posts and that are non-public.

These messages can only be read by users that the posting user has marked as friends.
In this step, you should add a third type of message. This third type of message should be readable by specified recipients only.

This means the database needs to provide the following:

  • A way of distinguishing between the three types of messages. This involves a change to the Message table.
  • A way of specifying who the recipients of a particular message are. This will probably require an additional table.

Your job is to implement the necessary changes and additional table for this purpose and any keys and foreign key
relationships required.

here are two existing tables witch relate to the task(copies from my db).

User table

CREATE TABLE IF NOT EXISTS `User` (
  `user_id` int(10) unsigned NOT NULL auto_increment,
  `given_name` varchar(60) default NULL,
  `surname` varchar(60) default NULL,
  `address` varchar(255) default NULL,
  `city_id` int(10) unsigned NOT NULL,
  `date_of_birth` datetime default NULL,
  `email` varchar(80) default NULL,
  PRIMARY KEY  (`user_id`),
  KEY `ix_user_surname` (`surname`),
  KEY `ix_user_given_name` (`given_name`),
  KEY `ix_user_name` (`given_name`,`surname`),
  KEY `ix_user_date_of_birth` (`date_of_birth`),
  KEY `ix_user_email` (`email`),
  KEY `ix_user_city_id` (`city_id`)
) ENGINE=InnoDB

Message table

CREATE TABLE IF NOT EXISTS `Message` (
  `message_id` int(10) unsigned NOT NULL auto_increment,
  `owner_id` int(10) unsigned default NULL,
  `subject` varchar(255) default NULL,
  `body` text,
  `posted` datetime default NULL,
  `is_public` tinyint(4) default '0',
  PRIMARY KEY  (`message_id`),
  KEY `ix_message_owner_id` (`owner_id`)
) ENGINE=InnoDB
  • 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-06-09T08:11:14+00:00Added an answer on June 9, 2026 at 8:11 am

    Ok, so is_public give you the ability to distinguish between two types (e.g. is_public = ‘0’ means private, and is_public = ‘1’ means public). But now you have a new concept of specified receipts, so the yes/no model won’t work anymore b/c you have 3 types. Usually in this situation you can switch to a flag or type column.

    So maybe make a message_type column that is one of ‘PUBLIC’, ‘PRIVATE’, ‘SPECIFIED’ or something like that.

    After that it sounds like you need at least two more tables. Users must be able to specify friends and users must be able to specify users to receive particular messages.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My present task is to dissect tcpdump data that includes P2P messages and I
I want to provide a button which cancels the present task, Let's say I
The task is to have 5 threads present at the same time, and the
I've inherited some code that I need to debug. It isn't working at present.
With the following database schema: User: UserID (primary key) UserInfo: UserInfoID (primary key), UserID
we are using Spring Integration 2.1 for persisting messages into database sent by clients.
I have a working SSIS task that executes once in a month and runs
I know it's simple task, but my mind not clicking at present for appropriate
I'm developing an app for GAE and trying to use Task Queues. At present,
Is there an ANT Task that would execute a block only if a given

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.