spec
This is an old revision of the document!
Table of Contents
Specification
Introduction
This page describes the specification of Fatworm project
Feature Requirements
Baseline
- Data Types
- Primitive INT, FLOAT, BOOLEAN
- Time TIMESTAMP, DATETIME
- String CHAR(), VARCHAR()
- Other DECIMAL(,)
- Components
- Storate
- Buffering
- Heap File
- SQL Parser and Engine
- Create / Drop databases
- Create / Drop tables
- Insert / Delete / Update tuples in table
- Basic SELECT on single or multiple table(s)
- More powerful SELECT
- DISTINCT
- Alias of tables
- [NOT] EXISTS
- ORDER BY can accept more than one column
- GROUP BY / HAVING clauses
- Functionality
- JDBC Interface
- Standalone Driver
Advance
- Components
- B+ Tree
- Basic B+ Tree Index support
- Balanced deleting
- Duplicated key support
- VARCHAR index
- More powerful SQL
- Create / Drop indexes (only involved with single column)
- Powerful SELECT
- Subquery as Scalar Operand
- Subquery as Relation Operand (ANY, ALL, IN)
- Subquery in FROM clause, see Syntax
- More complex INSERT: Insert subquery
- Database manager
- More than one database in system
- Concurrency control (locks on table)
- Concurrency control (locks on pages)
- Functionality:
- Support transaction
- Logger and roll back
- Supplementary Specication
- Syntax
- STRING & DATE
- Any CHAR, VARCHAR, DATETIME or TIMESTAMP starts and ends with a '.
- AUTO INCREMENT
- One table can have one column to be AUTO INCREMENT, and this column MUST BE the PRIMARY KEY.
- AUTO INCREMENT column MUST BE INT.
- When inserting a row, value in AUTO INCREMENT eld CAN be a value given. If no value were given, the value should be (MAX(this column)+1).If the value were not given and no row were in table, the value should be 1.
- Of couse, AUTO INCREMENT column CAN BE updated.
- INSERT
- If user used INSERT INTO table name VALUES (…), ALL elds should be specied.
- The Default value will be used, only when user uses INSERT INTO table name(…) VALUES (…).
- TIMESTAMP
- When inserting or updateing, if the value of this eld were not given,it means current time.
Misc
Version 4.1
Date Created 2012-2-25
Authors
- 02-ACMer
- Li Lei lilei@cs.cmu.edu
- Yang Linji dragonylj@sjtu.edu.cn
- Zhang Yaodong zhydong@sjtu.edu.cn
- 03-ACMer
- Ma Rong marong1204@gmail.com
- Zhou Muxin muxin.zhou@gmail.com
- Qian Feng fengqian@umich.edu
- Qu Wentao thomas.qu@gmail.com
- 04-ACMer
- Li Mu limu.cn@gmail.com
- Lian Xiaochen lianxiaochen@gmail.com
- Sun Xiaorui sunsirius@hotmail.com
- 05-ACMer
- Han Wei blue066@gmail.com
- Tian Yuan feldfar@gmail.com
- Zhang Kang jobo.zh@gmail.com
- 06-ACMer
- Chen Xiangru cxreinstein@gmail.com
- Chen Tianqi workcrow@gmail.com
- Zhu Yihe sjtu.pigoneand@gmail.com
- 07-ACMer
- Sheng Meilun sjmind2@gmail.com
- Wu Chenyang shivaw@gmail.com
- 08-ACMer
- Wu Yangwei wyw.wyw.good@gmail.com
- Sun Ruihua sun.ruih@gmail.com
- Pan Ye panye.sjtu@gmail.com
Syntax of FwSQL
Note: the syntax of FwSQL(Fatworm-SQL)is a simplified version of MySQL. Please go to http://dev.mysql.com/doc/ for more details.
- Create or Drop Database
- CREATE DATABASE db-name
- USE db-name
- DROP DATABASE db-name
- Create or Drop table
- CREATE TABLE tbl-name (create-definition, …)
- DROP TABLE tbl-name [,tbl-name]
- create-definition ::= column-definition | PRIMARY KEY (col-name)
- column-definition ::= col-name data-type [[Not]NULL] [DEFAULT const-value][AUTO_INCREMENT]
- data-type ::= INT | FLOAT | CHAR(M) | DATETIME | BOOLEAN | DECIMAL(M[,D]) | TIMESTAMP | VARCHAR(M)
-Insert
- INSERT INTO tbl-name VALUES (value, …)
- INSERT INTO tbl-name(col-name,…)VALUES(value,…)
- INSERT INTO tbl-name(subquery)
-Delete
- DELETE FROM tbl-name [WHERE where-condition]
-Update
- UPDATE tbl-name SET col-name1=value [,col-name2=value…][WHERE where-condition]
- Create or Drop index
- CREATE [UNIQUE] INDEX index-name ON tbl-name (col-name)
- DROP INDEX index-name ON tbl-name
- Select
- SELECT [DISTINCT] select-expr,…
[FROM tbl-ref[,tbl-ref]…]
[WHERE where-condition]
[GROUP BY col-name]
[HAVING having-condition]
[ORDERE BY col-name[ ASC | DESC ],…] - select-expr ::=value [AS alias]|*
- func ::= AVG | COUNT | MIN | MAX | SUM
- col-name ::= [tbl-name.] col-name
- tbl-ref ::=tbl-name[AS alias]
|(subquery) AS alias - where-condition::=bool-expr
- bool-expr ::=value cop value
| bool-expr AND bool-expr
| bool-expr OR bool-expr
| [NOT] EXISTS (subquery)
| value cop ANY (subquery)
| value IN (subquery)
| value cop ALL (subquery)
| (bool-expr) - cop ::= < | > | = | >= | >= | <>
- value ::= (value)|col-name|const-value|value aop value
| (subquery with only one elements(or NULL)in the result table)
| func(col-name) - aop ::= + | - | * | / | %
- const-value ::= integer | 'string' | float | 'YYYY-MM-DD HH:MM:SS' | TRUE | FALSE | NULL | DEFAULT
- having-condition ::= bool-expr
spec.1330331194.txt.gz · Last modified: 2012/02/27 08:26 by wuyw