Complete Site access Statistics system (one: Database article)

Source: Internet
Author: User
Original: Tofu
Please keep this message when you reprint and use it.
*/
1. Database structure
/* Access to the Statistics History table, every visit to generate a record in this table * *
CREATE TABLE [Accessstat] (
[Autoid] [INT] IDENTITY (1, 1) not NULL,
[UserID] [varchar] (5) NULL,
[Visittime] [DateTime] Null
[IPADDR] [varchar] (a) NULL,
[Usesystem] [varchar] (a) NULL,
[BrowserType] [varchar] (a) NULL,
[LastPage] [varchar] (m) NULL
) on [PRIMARY]
Go
* * 24 hours a day to access the statistical effect * *
CREATE TABLE [Datestatic] (
[DateID] [smallint] Not NULL,
[Hourid] [smallint] Not NULL,
[UserID] [varchar] (ten) Not NULL,
[Num] [INT] Null
) on [PRIMARY]
Go
* * Seven days a week to access the statistical effect * *
CREATE TABLE [Weekstatic] (
[Weekid] [INT] Not NULL,
[Dayid] [INT] Not NULL,
[UserID] [varchar] (ten) Not NULL,
[Num] [INT] Null
) on [PRIMARY]
Go
* January 31 Days Access Statistics Effect * *
CREATE TABLE [Monthstatic] (
[Monthid] [INT] Not NULL,
[Dayid] [INT] Not NULL,
[UserID] [varchar] (ten) Not NULL,
[Num] [INT] Null
) on [PRIMARY]
Go
* * 12 months a year access statistics effect * *
CREATE TABLE [Yearstatic] (
[Yearid] [INT] Not NULL,
[Monthid] [INT] Not NULL,
[UserID] [varchar] (ten) Not NULL,
[Num] [INT] Null
) on [PRIMARY]
Go
Use these five tables to generate statistical results of the data source, the owner of a few days ago has posted a no behind the four tables of a stored procedure, is to generate the results of the following tables!
In order to improve the speed, the extra redundancy was added to these several tables
* * Not completed


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.