faqts : Computers : Databases : Microsoft SQL Server

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

8 of 8 people (100%) answered Yes
Recently 8 of 8 people (100%) answered Yes

Entry

Database: Create: Todo: Simple: How create simple todo database on Microsoft SQL server, using SQL?

Dec 31st, 2003 11:42
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 31 December 2003 - 08:37 pm -------------------
Database: Create: Todo: Simple: How create simple todo database on 
Microsoft SQL server, using SQL?
---
One of the most simple todo database might consist of:
 1. one table with one column
    containing the text of the things to do
 2. operations:
    1. insert in table
    2. delete from table
    3. view table
    4. search table
---
---
Steps: Overview:
 1. -Create a database
 2. -Use database
 3. -Create tables
 4. -Create operations
     1. Create operation 'insert' in table
     2. Create operation 'delete' from table
     3. Create operation 'view' table
     4. Create operation 'search' table
---
---
Steps: Worked out:
 1. -Create a database
      CREATE DATABASE Todolist ON (
       NAME = 'Todolist',
       FILENAME = 'c:\program files\microsoft sql 
server\mssql\data\todolist.mdf',
       SIZE = 1,
       MAXSIZE = 5,
       FILEGROWTH = 5
      )
      LOG ON (
       NAME = 'sa',
       FILENAME = 'c:\program files\microsoft sql 
server\mssql\data\todolist.ldf',
       SIZE = 1MB,
       MAXSIZE = 2MB,
       FILEGROWTH = 2MB
      )
      GO
 2. -Use database
      USE Todolist
 3. -Create tables
      CREATE TABLE Todo (
       TodoText VARCHAR( 250 ) NOT NULL,
       TodoKey INT NOT NULL,
       PRIMARY KEY ( TodoKey )
      );
 4. -Create operations
     1. Create operation 'insert' in table
      e.g.
       INSERT INTO Todo ( TodoText, TodoKey ) VALUES ( 'your first 
todo task', 1 );
       INSERT INTO Todo ( TodoText, TodoKey ) VALUES ( 'your second 
todo task', 2 );
       INSERT INTO Todo ( TodoText, TodoKey ) VALUES ( 'your third 
todo task', 3 );
     2. Create operation 'delete' from table
      e.g.
       DELETE FROM Todo WHERE ( TodoKey = 1 )
       DELETE FROM Todo WHERE ( TodoKey = 2 )
       DELETE FROM Todo WHERE ( TodoKey = 3 )
     3. Create operation 'view' table
      e.g.
       SELECT * FROM Todo
       SELECT TodoText, TodoKey FROM Todo
     4. Create operation 'search' table
      e.g.
       SELECT * FROM Todo WHERE TodoText LIKE '%task%'
       SELECT TodoText, TodoKey FROM Todo WHERE TodoText LIKE '%task%'
---
---
Internet: see also:
---
Database: Create: Todo: Simple: Overview: Can you give overview how to 
create simple todo database?
http://www.faqts.com/knowledge_base/view.phtml/aid/27882/fid/147
----------------------------------------------------------------------