Ylbtech- database design and Optimization for checkboxes / radio collection of l
Recommended for you: Get network issues from WhatsUp Gold. Not end users.
Ylbtech-DatabaseDesgin:ylbtech- database design and Optimization for checkboxes / radio collection of list table design |
DatabaseName: general table structure
--
-- mainly aims at going to design the table object, the table should have the following characteristics
-- 1, The object is mainly as a set of check table | radio list using the
-- 2, No more table columns
--
Advantages:
-- Simplified database table a lot of creation and the work of the programmer, maintenance and expansion to facilitate later
1.A, Database diagram(Database Diagram) |
1.B, Database design script(Database Design Script) |
use master go -- ============================================= -- DatabaseName: general table structure -- -- Is mainly directed against the design table, the table should have the following characteristics -- 1, The object is mainly as a set of check table | radio list using the -- 2, No more table columns -- -- Advantage -- A simplified database table creation and the work of the programmer, maintenance and expansion to facilitate later -- -- author:Yuanbo -- pubdate:2013-8-14 16:01 -- ============================================= IF EXISTS (SELECT * FROM master..sysdatabases WHERE name = N'GenericDatabase') DROP DATABASE GenericDatabase GO CREATE DATABASE GenericDatabase GO use GenericDatabase go -- ============================================= -- ylb:1,Universal table -- ============================================= go create table GenericTable ( [id] int primary key identity(100,1), --No.[PK, ID] [name] varchar(100) unique, --The display name[UQ] info varchar(100), --Explain [type] varchar(20), --Type checkbox, radio enabled bit default(1) --Whether to enable 0: does not enable; 1: enabled ) go -- ============================================= -- ylb:2,General column -- ref 1,Universal table -- ============================================= create table GenericColumn ( ctext varchar(200), --Column display value cvalue varchar(200), --Column value checked bit default(0), --If the selected 0: not selected; 1: Selected enabled bit default(1), --Whether to enable 0: does not enable; 1: enabled genericTableId int references GenericTable([id]) --Table number[FK] ) go print 'Create databaseļ¼'
1.C, Function code(Function Implementation Code) |
![]() |
Author: ylbtech Source: The copyright belongs to the author and blog park there, welcome to reprint, but without the permission of the author must keep this statement, and the connection in the article page is the obvious position, or retain the right to pursue legal responsibilities. |
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download
Posted by Brendan at November 19, 2013 - 1:55 AM