The Database Design for the Kshare Application XML

The Kshare database consists of tables that store data in a structured format. In addition, the database consists of stored procedures that are used to access data from the tables in the Kshare database.

Tables in the Kshare Database

The tables in the Kshare database and their structures are described in the following list:

  • Queries table. This table stores the queries posted by various users of Kshare. The structure of the Queries table is shown in Figure.
  • The Queries Table.

    The Queries Table.

    As discussed earlier, whenever a user posts a query, a unique query ID is assigned to the query. This query ID along with the query is stored in the Queries table. To learn more about the data stored in the fields of the Queries table, refer to Table.

    Fields in the Queries Table

    Fields in the Queries Table

  • Category table. This table stores a list of permissible categories on which a user can post a query. In addition, the Category table stores the descriptions of various categories, as discussed in Table. The structure of the Category table is shown in Figure.
  • Fields in the Category Table

    Fields in the Category Table

    The Category Table.

    The Category Table.

  • Answers table. This table stores the response of the experts to the queries that the users post. The fields in the Answers table are shown in Table, and the structure of the Answers table is shown in Figure.
  • Fields in the Answers Table

    Fields in the Answers Table

    The Answers Table.

    The Answers Table.

  • Experts table. This table stores a list of people, as discussed in Table, who are nominated as experts for different topics or categories. The structure of the Experts table is shown in Figure.
  • Fields in the Experts Table

    Fields in the Experts Table

    The Experts Table.

    The Experts Table.

Figure shows the relationship between the tables in the Kshare database.

The Relationship between the Tables in the Kshare Database.

The Relationship between the Tables in the Kshare Database.

As discussed, the database at Flex Automobiles, Inc. also contains stored procedures to access data from the tables in the database. The following section discusses the stored procedures in the Kshare database.

Stored Procedures in the Kshare Database

For the Kshare Web services project, the team has decided to provide the database interactivity through stored procedures because they offer performance advantages. The stored procedures used in the Kshare Web services project are discussed in the following list:

  • AddQuery. This stored procedure accepts a query, the category, a reference ID for a previous query, and a user's name as parameters; then it adds a new record to the Queries table.
  • PostAnswer. This stored procedure accepts a response for a query, the ID of the query for which this is an answer, and the expert's login name.
  • GetAllQueries. This stored procedure returns a complete list of all queries in the Queries table.
  • GetQueriesbyCategory. This stored procedure accepts a category name as a parameter and returns a list of all queries for that category.
  • GetMyQueries. This stored procedure returns a list of the queries posted by a particular user.
  • AddExpert. This stored procedure adds an expert in the Experts table.

Now, to create the stored procedures, as discussed in the previous list, add the following code to the Enterprise Manager of Microsoft SQL Server:


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

XML Topics