├── index catalog
├── table catalog
├── test13.txt
├── test9.txt
├── Zrztest.txt
├── src
├── API.java
├── lexer
│ ├── Tag.java
│ ├── Lexer.java
│ ├── Token.java
│ ├── Num.java
│ ├── Word.java
│ └── Comparison.java
├── Interpreter.java
├── BUFFERMANAGER
│ ├── Block.java
│ └── BufferManager.java
├── CATALOGMANAGER
│ ├── index.java
│ ├── table.java
│ ├── attribute.java
│ └── CatalogManager.java
├── RECORDMANAGER
│ ├── tuple.java
│ ├── RecordManager.java
│ └── conditionNode.java
├── FILEMANAGER
│ └── FileManager.java
└── IndexManager
│ ├── BPlusTree.java
│ ├── IndexManager.java
│ └── offsetInfo.java
├── .gitattributes
├── Report 3.0.pdf
├── bin
├── API.class
├── lexer
│ ├── Num.class
│ ├── Tag.class
│ ├── Lexer.class
│ ├── Token.class
│ ├── Word.class
│ └── Comparison.class
├── Interpreter.class
├── BUFFERMANAGER
│ ├── Block.class
│ └── BufferManager.class
├── RECORDMANAGER
│ ├── tuple.class
│ ├── RecordManager.class
│ ├── conditionNode.class
│ └── RecordManager$MyCompare.class
├── CATALOGMANAGER
│ ├── index.class
│ ├── table.class
│ ├── attribute.class
│ └── CatalogManager.class
├── IndexManager
│ ├── BPlusTree.class
│ ├── offsetInfo.class
│ ├── BPlusTree$Node.class
│ ├── IndexManager.class
│ ├── BPlusTree$LeafNode.class
│ └── BPlusTree$InternalNode.class
└── FILEMANAGER
│ └── FileManager.class
├── test7.txt
├── instruction_create_insert_1.txt
├── instruction_buildIndex.txt
├── test4.txt
├── test10.txt
├── test6.txt
├── test8.txt
├── test12.txt
├── test1.txt
├── test5.txt
├── .classpath
├── test.txt
├── .project
├── test2.txt
├── test3.txt
├── .settings
└── org.eclipse.jdt.core.prefs
├── testTable.txt
├── README.md
├── instruction_create&insert_2.txt
└── test11.txt
/index catalog:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/table catalog:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test13.txt:
--------------------------------------------------------------------------------
1 | drop database db;
2 |
3 | quit;
--------------------------------------------------------------------------------
/test9.txt:
--------------------------------------------------------------------------------
1 | drop index name;
2 | drop table t2;
3 | drop database db;
--------------------------------------------------------------------------------
/Zrztest.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/Zrztest.txt
--------------------------------------------------------------------------------
/src/API.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/API.java
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
--------------------------------------------------------------------------------
/Report 3.0.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/Report 3.0.pdf
--------------------------------------------------------------------------------
/bin/API.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/API.class
--------------------------------------------------------------------------------
/bin/lexer/Num.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/lexer/Num.class
--------------------------------------------------------------------------------
/bin/lexer/Tag.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/lexer/Tag.class
--------------------------------------------------------------------------------
/src/lexer/Tag.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/lexer/Tag.java
--------------------------------------------------------------------------------
/test7.txt:
--------------------------------------------------------------------------------
1 | select * from t2 where num1>num2;
2 | select * from t2 where num1>num2 and num1>30;
--------------------------------------------------------------------------------
/bin/Interpreter.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/Interpreter.class
--------------------------------------------------------------------------------
/bin/lexer/Lexer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/lexer/Lexer.class
--------------------------------------------------------------------------------
/bin/lexer/Token.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/lexer/Token.class
--------------------------------------------------------------------------------
/bin/lexer/Word.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/lexer/Word.class
--------------------------------------------------------------------------------
/src/Interpreter.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/Interpreter.java
--------------------------------------------------------------------------------
/src/lexer/Lexer.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/lexer/Lexer.java
--------------------------------------------------------------------------------
/bin/lexer/Comparison.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/lexer/Comparison.class
--------------------------------------------------------------------------------
/bin/BUFFERMANAGER/Block.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/BUFFERMANAGER/Block.class
--------------------------------------------------------------------------------
/bin/RECORDMANAGER/tuple.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/RECORDMANAGER/tuple.class
--------------------------------------------------------------------------------
/src/BUFFERMANAGER/Block.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/BUFFERMANAGER/Block.java
--------------------------------------------------------------------------------
/src/CATALOGMANAGER/index.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/CATALOGMANAGER/index.java
--------------------------------------------------------------------------------
/src/CATALOGMANAGER/table.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/CATALOGMANAGER/table.java
--------------------------------------------------------------------------------
/src/RECORDMANAGER/tuple.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/RECORDMANAGER/tuple.java
--------------------------------------------------------------------------------
/bin/CATALOGMANAGER/index.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/CATALOGMANAGER/index.class
--------------------------------------------------------------------------------
/bin/CATALOGMANAGER/table.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/CATALOGMANAGER/table.class
--------------------------------------------------------------------------------
/bin/IndexManager/BPlusTree.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/IndexManager/BPlusTree.class
--------------------------------------------------------------------------------
/instruction_create_insert_1.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/instruction_create_insert_1.txt
--------------------------------------------------------------------------------
/src/FILEMANAGER/FileManager.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/FILEMANAGER/FileManager.java
--------------------------------------------------------------------------------
/src/IndexManager/BPlusTree.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/IndexManager/BPlusTree.java
--------------------------------------------------------------------------------
/bin/CATALOGMANAGER/attribute.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/CATALOGMANAGER/attribute.class
--------------------------------------------------------------------------------
/bin/FILEMANAGER/FileManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/FILEMANAGER/FileManager.class
--------------------------------------------------------------------------------
/bin/IndexManager/offsetInfo.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/IndexManager/offsetInfo.class
--------------------------------------------------------------------------------
/src/CATALOGMANAGER/attribute.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/CATALOGMANAGER/attribute.java
--------------------------------------------------------------------------------
/src/IndexManager/IndexManager.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/IndexManager/IndexManager.java
--------------------------------------------------------------------------------
/bin/BUFFERMANAGER/BufferManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/BUFFERMANAGER/BufferManager.class
--------------------------------------------------------------------------------
/bin/IndexManager/BPlusTree$Node.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/IndexManager/BPlusTree$Node.class
--------------------------------------------------------------------------------
/bin/IndexManager/IndexManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/IndexManager/IndexManager.class
--------------------------------------------------------------------------------
/bin/RECORDMANAGER/RecordManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/RECORDMANAGER/RecordManager.class
--------------------------------------------------------------------------------
/bin/RECORDMANAGER/conditionNode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/RECORDMANAGER/conditionNode.class
--------------------------------------------------------------------------------
/instruction_buildIndex.txt:
--------------------------------------------------------------------------------
1 | create index ind_stu2_name on student2(name);
2 | create index ind_stu2_id on student2(id);
3 | quit;
--------------------------------------------------------------------------------
/src/BUFFERMANAGER/BufferManager.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/BUFFERMANAGER/BufferManager.java
--------------------------------------------------------------------------------
/src/RECORDMANAGER/RecordManager.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/RECORDMANAGER/RecordManager.java
--------------------------------------------------------------------------------
/src/RECORDMANAGER/conditionNode.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/RECORDMANAGER/conditionNode.java
--------------------------------------------------------------------------------
/bin/CATALOGMANAGER/CatalogManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/CATALOGMANAGER/CatalogManager.class
--------------------------------------------------------------------------------
/src/CATALOGMANAGER/CatalogManager.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/src/CATALOGMANAGER/CatalogManager.java
--------------------------------------------------------------------------------
/bin/IndexManager/BPlusTree$LeafNode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/IndexManager/BPlusTree$LeafNode.class
--------------------------------------------------------------------------------
/bin/IndexManager/BPlusTree$InternalNode.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/IndexManager/BPlusTree$InternalNode.class
--------------------------------------------------------------------------------
/bin/RECORDMANAGER/RecordManager$MyCompare.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LeeLeeYeah/MiniSQL/HEAD/bin/RECORDMANAGER/RecordManager$MyCompare.class
--------------------------------------------------------------------------------
/test4.txt:
--------------------------------------------------------------------------------
1 | select * from t1 where id>4 and salary >=2000.00;
2 | select * from t1 where id<3 or salary <1800.00;
3 | select * from t1 where age>25 and age <30;
--------------------------------------------------------------------------------
/test10.txt:
--------------------------------------------------------------------------------
1 | create database db;
2 |
3 | use db;
4 |
5 | create table author
6 | (
7 | a_id int,
8 | a_name char(100),
9 | primary key(a_name)
10 | );
11 |
--------------------------------------------------------------------------------
/test6.txt:
--------------------------------------------------------------------------------
1 | insert into t2 values(10,20);
2 | insert into t2 values(20,30);
3 | insert into t2 values(30,20);
4 | insert into t2 values(30,10);
5 | insert into t2 values(50,20);
6 | insert into t2 values(20,50);
--------------------------------------------------------------------------------
/test8.txt:
--------------------------------------------------------------------------------
1 | delete from t2 where num1>num2;
2 | delete from t2;
3 |
4 | delete from t1 where id>7;
5 | delete from t1 where id<=2;
6 | delete from t1 where id<4 and salary >3000.00;
7 |
8 | delete from t1 where salary >3000 or age >24;
--------------------------------------------------------------------------------
/test12.txt:
--------------------------------------------------------------------------------
1 | select a_name from author where a_id>35;
2 | select * from author where a_name <'naae';
3 | select * from author where a_name <'naat' and a_id<3;
4 |
5 | delete from author where a_name >'nnae';
6 | delete from author where a_name <'naba';
7 |
8 |
--------------------------------------------------------------------------------
/test1.txt:
--------------------------------------------------------------------------------
1 | drop table t1;drop table t2;
2 | create table t1
3 | (
4 | id int ,
5 | name char(20) unique,
6 | age int ,
7 | salary float,
8 | primary key(id)
9 | );
10 |
11 | create table t2
12 | (
13 | num1 int ,
14 | num2 int
15 | );
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/test5.txt:
--------------------------------------------------------------------------------
1 | select id , name,age, salary from t1;
2 | select name,salary from t1;
3 |
4 | select id , name from t1 where id>=6;
5 | select id , name from t1 where name>='Queen';
6 | select id , name from t1 where salary<2000.00;
7 | select id , name from t1 where salary >4000.00 and name<>'Jim';
--------------------------------------------------------------------------------
/src/lexer/Token.java:
--------------------------------------------------------------------------------
1 | package lexer;
2 |
3 | public class Token {
4 | public final int tag;
5 |
6 | public Token(int t) {
7 | this.tag = t;
8 | }
9 |
10 | public String toString() {
11 | return "" + (char)tag;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/test.txt:
--------------------------------------------------------------------------------
1 | drop table aaa;
2 | create table aaa (
3 | sno char(8),
4 | sname char(16) unique,
5 | sage int,
6 | sgender char (1),
7 | smoney float,
8 | primary key ( sno )
9 | );
10 | create index ab on aaa(sname); drop index ab;
11 | insert into aaa values
12 | ('33333333','abababababababab',18,m,4.5);
13 | delete from aaa;
14 |
--------------------------------------------------------------------------------
/src/IndexManager/offsetInfo.java:
--------------------------------------------------------------------------------
1 | package IndexManager;
2 |
3 | import java.util.Vector;
4 |
5 | public class offsetInfo {
6 | public Vector offsetInfile;
7 | public Vector offsetInBlock;
8 | public int length;
9 | public offsetInfo(){
10 | offsetInfile = new Vector();
11 | offsetInBlock = new Vector();
12 | length=0;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | MiniSql
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/src/lexer/Num.java:
--------------------------------------------------------------------------------
1 | package lexer;
2 |
3 | public class Num extends Token{
4 | public final double value;
5 |
6 | public Num(float v) {
7 | super(Tag.FLOATNUM);
8 | this.value = v;
9 | }
10 | public Num(int v) {
11 | super(Tag.INTNUM);
12 | this.value = v;
13 | }
14 | public String toString() {
15 | if(this.tag==Tag.INTNUM)
16 | return "" + (int)value;
17 | else return "" + (float)value;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/test2.txt:
--------------------------------------------------------------------------------
1 | insert into t1 values(1,'Jim',20,2000.00);
2 | insert into t1 values(2,'Kate',24,1800.00);
3 | insert into t1 values(3,'John',34,4000.00);
4 | insert into t1 values(4,'Marry',20,3000.00);
5 | insert into t1 values(5,'Tom',24,1850.00);
6 | insert into t1 values(6,'Queen',28,24000.00);
7 | insert into t1 values(7,'Porry',17,1000.00);
8 | insert into t1 values(8,'Green',24,8000.00);
9 | insert into t1 values(8,'Jim',20,4000.00);
10 | insert into t1 values(9,'Green',22,4000.00);
11 |
12 | create index name on t1(name);
13 |
--------------------------------------------------------------------------------
/test3.txt:
--------------------------------------------------------------------------------
1 | select * from t1;
2 |
3 | select * from t1 where id>6;
4 | select * from t1 where id<3;
5 | select * from t1 where id>=6;
6 | select * from t1 where id<=3;
7 | select * from t1 where id=6;
8 | select * from t1 where id<>6;
9 |
10 | select * from t1 where name='Jim';
11 | select * from t1 where name<>'Jim';
12 | select * from t1 where name>='Queen' order by name ;
13 | select * from t1 where name<='Jim';
14 |
15 | select * from t1 where salary<1850.00 order by salary;
16 | select * from t1 where salary>=4000.00;
17 | select * from t1 where salary=3000.00;
18 | select * from t1 where salary<>3000.00 order by salary;
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.8
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.8
12 |
--------------------------------------------------------------------------------
/testTable.txt:
--------------------------------------------------------------------------------
1 | drop table student;
2 | drop table teacher;
3 | create table student (
4 | sno char(8),
5 | sname char(16) unique,
6 | sage int,
7 | sgender char (1),
8 | primary key ( sno )
9 | );
10 | create table student (
11 | sno char(8),
12 | sname char(16) unique,
13 | sage int,
14 | sgender char (1),
15 | primary key ( sno )
16 | );
17 |
18 | create table teacher(sno char(8),
19 | sname char(16) unique,
20 | sage int,
21 | sgender char (1),
22 | primary key ( sno )
23 | );
24 | create table teacher(sno char(8),
25 | sname char(256) unique,
26 | sage int,
27 | sgender char (1),
28 | primary key ( sno )
29 | );create table teacher2(sno char(8),
30 | sname char(256) unique,
31 | sage int,
32 | sgender char (1),
33 | primary key ( ss )
34 | );
35 | create table teach(sno char(8),
36 | sname char(8) unique,
37 | sname int,
38 | sgender char (1),
39 | primary key ( sno )
40 | );
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MiniSQL
2 | It is the project for the Database Design course at ZJU. It is a mini database system like MySQL, but it's built by ourselves.
3 |
4 | It implemented the following notion in Database Design:
5 | - Buffer Manager (Cache, with clock replacement algorithms)
6 | - Record Manager (Organization of records in a table)
7 | - Index Manager (B+ tree)
8 | - Catalog Manager (Maintain catalog information)
9 | - Interpreter
10 | 
11 |
12 | In terms of functions, we implemented the following queries:
13 | - Table creation, deletion
14 | - Insert
15 | - Select, including \*, from, where, and, or, parentheses, order by, join
16 | - Delete
17 | - Build Index
18 | - Drop
19 | - Show tables
20 | - Show indexes
21 | 
22 |
23 | Our team got full marks for this project, and I got 100 from this course. HAHAHAHAHA..
--------------------------------------------------------------------------------
/src/lexer/Word.java:
--------------------------------------------------------------------------------
1 | package lexer;
2 |
3 | public class Word extends Token {
4 | public String lexme = "";
5 |
6 | public Word (String s, int t) {
7 | super(t);
8 | this.lexme = s;
9 | }
10 |
11 | public String toString() {
12 | return this.lexme;
13 | }
14 |
15 | // public static final Word
16 | // and = new Comparison("&&", Tag.AND),
17 | // or = new Comparison("||", Tag.OR),
18 | // lt=new Word ("<", Tag.OP),
19 | // gt= new Word (">", Tag.OP),
20 | // eq = new Word ("==", Tag.OP),
21 | // ne = new Word("!=", Tag.OP),
22 | // le = new Word("<=", Tag.OP),
23 | // ge = new Word(">=", Tag.OP);
24 | // minus = new Comparison("minus", Tag.MINUS),
25 | // True = new Comparison("true", Tag.TRUE),
26 | // False = new Comparison("false", Tag.FALSE);
27 | //temp = new Comparison("t", Tag.TEMP);
28 | }
29 |
--------------------------------------------------------------------------------
/src/lexer/Comparison.java:
--------------------------------------------------------------------------------
1 | package lexer;
2 |
3 | public class Comparison extends Word{
4 | public Comparison(String s, int tag) {
5 | super(s, tag);
6 | }
7 | public static Comparison parseCompar(Token a){
8 | String aa=a.toString();
9 | return Comparison.parseCompar(aa);
10 | }
11 | public static Comparison parseCompar(String a){
12 | if(a.equals("<"))return lt;
13 | else if(a.equals(">"))return gt;
14 | else if(a.equals("<="))return le;
15 | else if(a.equals(">="))return ge;
16 | else if(a.equals("=="))return eq;
17 | else if(a.equals("="))return eq;
18 | else if(a.equals("<>"))return ne;
19 | else return null;
20 | }
21 | public static final Comparison
22 | lt=new Comparison ("<", Tag.OP),
23 | gt= new Comparison (">", Tag.OP),
24 | eq = new Comparison ("==", Tag.OP),
25 | ne = new Comparison("<>", Tag.OP),
26 | le = new Comparison("<=", Tag.OP),
27 | ge = new Comparison(">=", Tag.OP);
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/instruction_create&insert_2.txt:
--------------------------------------------------------------------------------
1 | create table student_department(id int, department char(20), primary key(id));
2 | insert into student_department values(1080100001,'Computer');
3 | insert into student_department values(1080100003,'Physics');
4 | insert into student_department values(1080100004,'Math');
5 | insert into student_department values(1080100005,'Arts');
6 | insert into student_department values(1080100006,'Medicine');
7 | insert into student_department values(1080100007,'Computer');
8 | insert into student_department values(1080100008,'Computer');
9 | insert into student_department values(1080100009,'Computer');
10 | insert into student_department values(1080100010,'Computer');
11 | insert into student_department values(1080100011,'Arts');
12 | insert into student_department values(1080100012,'Math');
13 | insert into student_department values(1080100013,'Math');
14 | insert into student_department values(1080100014,'Arts');
15 | insert into student_department values(1080100015,'Math');
16 | insert into student_department values(1080100016,'Medicine');
17 | insert into student_department values(1080100017,'Medicine');
18 | insert into student_department values(1080100018,'Math');
19 | insert into student_department values(1080100019,'Medicine');
20 | insert into student_department values(1080100020,'Medicine');
21 | insert into student_department values(1080100021,'Math');
22 | insert into student_department values(1080100022,'Medicine');
23 | insert into student_department values(1080100023,'Math');
24 | insert into student_department values(1080100024,'Medicine');
25 | insert into student_department values(1080100025,'Medicine');
26 | insert into student_department values(1080100026,'Medicine');
27 | insert into student_department values(1080100027,'Arts');
28 | insert into student_department values(1080100028,'Medicine');
29 | insert into student_department values(1080100029,'Physics');
30 | insert into student_department values(1080100030,'Arts');
31 | insert into student_department values(1080100031,'Physics');
32 | insert into student_department values(1080100032,'Physics');
33 | insert into student_department values(1080100033,'Arts');
34 | insert into student_department values(1080100034,'Arts');
35 |
--------------------------------------------------------------------------------
/test11.txt:
--------------------------------------------------------------------------------
1 | insert into author values(1, 'naaa');
2 | insert into author values(2, 'naab');
3 | insert into author values(3, 'naac');
4 | insert into author values(4, 'naad');
5 | insert into author values(5, 'naae');
6 | insert into author values(6, 'naaf');
7 | insert into author values(7, 'naag');
8 | insert into author values(8, 'naah');
9 | insert into author values(9, 'naai');
10 | insert into author values(10,'naaj');
11 | insert into author values(11,'naak');
12 | insert into author values(12,'naal');
13 | insert into author values(13,'naam');
14 | insert into author values(14,'naan');
15 | insert into author values(15,'naao');
16 | insert into author values(16,'naap');
17 | insert into author values(17,'naaq');
18 | insert into author values(18,'naar');
19 | insert into author values(19,'naas');
20 | insert into author values(20,'naat');
21 | insert into author values(21,'naau');
22 | insert into author values(22,'naav');
23 | insert into author values(23,'naaw');
24 | insert into author values(24,'naax');
25 | insert into author values(25,'naay');
26 | insert into author values(26,'naaz');
27 | insert into author values(27, 'naba');
28 | insert into author values(28, 'nabb');
29 | insert into author values(29, 'nabc');
30 | insert into author values(30, 'nabd');
31 | insert into author values(31, 'nabe');
32 | insert into author values(32, 'nabf');
33 | insert into author values(33, 'nabg');
34 | insert into author values(34, 'nabh');
35 | insert into author values(35, 'nabi');
36 | insert into author values(36, 'nabj');
37 | insert into author values(37, 'nabk');
38 | insert into author values(38, 'nabl');
39 |
40 | insert into author values(1, 'nbaa');
41 | insert into author values(2, 'nbab');
42 | insert into author values(3, 'nbac');
43 | insert into author values(4, 'nbad');
44 | insert into author values(5, 'nbae');
45 | insert into author values(6, 'nbaf');
46 | insert into author values(7, 'nbag');
47 | insert into author values(8, 'nbah');
48 | insert into author values(9, 'nbai');
49 | insert into author values(10,'nbaj');
50 | insert into author values(11,'nbak');
51 | insert into author values(12,'nbal');
52 | insert into author values(13,'nbam');
53 | insert into author values(14,'nban');
54 | insert into author values(15,'nbao');
55 | insert into author values(16,'nbap');
56 | insert into author values(17,'nbaq');
57 | insert into author values(18,'nbar');
58 | insert into author values(19,'nbas');
59 | insert into author values(20,'nbat');
60 | insert into author values(21,'nbau');
61 | insert into author values(22,'nbav');
62 | insert into author values(23,'nbaw');
63 | insert into author values(24,'nbax');
64 | insert into author values(25,'nbay');
65 | insert into author values(26,'nbaz');
66 | insert into author values(27, 'nbba');
67 | insert into author values(28, 'nbbb');
68 | insert into author values(29, 'nbbc');
69 | insert into author values(30, 'nbbd');
70 | insert into author values(31, 'nbbe');
71 | insert into author values(32, 'nbbf');
72 | insert into author values(33, 'nbbg');
73 | insert into author values(34, 'nbbh');
74 | insert into author values(35, 'nbbi');
75 | insert into author values(36, 'nbbj');
76 | insert into author values(37, 'nbbk');
77 | insert into author values(38, 'nbbl');
78 |
79 | insert into author values(1, 'ncaa');
80 | insert into author values(2, 'ncab');
81 | insert into author values(3, 'ncac');
82 | insert into author values(4, 'ncad');
83 | insert into author values(5, 'ncae');
84 | insert into author values(6, 'ncaf');
85 | insert into author values(7, 'ncag');
86 | insert into author values(8, 'ncah');
87 | insert into author values(9, 'ncai');
88 | insert into author values(10,'ncaj');
89 | insert into author values(11,'ncak');
90 | insert into author values(12,'ncal');
91 | insert into author values(13,'ncam');
92 | insert into author values(14,'ncan');
93 | insert into author values(15,'ncao');
94 | insert into author values(16,'ncap');
95 | insert into author values(17,'ncaq');
96 | insert into author values(18,'ncar');
97 | insert into author values(19,'ncas');
98 | insert into author values(20,'ncat');
99 | insert into author values(21,'ncau');
100 | insert into author values(22,'ncav');
101 | insert into author values(23,'ncaw');
102 | insert into author values(24,'ncax');
103 | insert into author values(25,'ncay');
104 | insert into author values(26,'ncaz');
105 | insert into author values(27, 'ncba');
106 | insert into author values(28, 'ncbb');
107 | insert into author values(29, 'ncbc');
108 | insert into author values(30, 'ncbd');
109 | insert into author values(31, 'ncbe');
110 | insert into author values(32, 'ncbf');
111 | insert into author values(33, 'ncbg');
112 | insert into author values(34, 'ncbh');
113 | insert into author values(35, 'ncbi');
114 | insert into author values(36, 'ncbj');
115 | insert into author values(37, 'ncbk');
116 | insert into author values(38, 'ncbl');
117 |
118 | insert into author values(1, 'ndaa');
119 | insert into author values(2, 'ndab');
120 | insert into author values(3, 'ndac');
121 | insert into author values(4, 'ndad');
122 | insert into author values(5, 'ndae');
123 | insert into author values(6, 'ndaf');
124 | insert into author values(7, 'ndag');
125 | insert into author values(8, 'ndah');
126 | insert into author values(9, 'ndai');
127 | insert into author values(10,'ndaj');
128 | insert into author values(11,'ndak');
129 | insert into author values(12,'ndal');
130 | insert into author values(13,'ndam');
131 | insert into author values(14,'ndan');
132 | insert into author values(15,'ndao');
133 | insert into author values(16,'ndap');
134 | insert into author values(17,'ndaq');
135 | insert into author values(18,'ndar');
136 | insert into author values(19,'ndas');
137 | insert into author values(20,'ndat');
138 | insert into author values(21,'ndau');
139 | insert into author values(22,'ndav');
140 | insert into author values(23,'ndaw');
141 | insert into author values(24,'ndax');
142 | insert into author values(25,'nday');
143 | insert into author values(26,'ndaz');
144 | insert into author values(27, 'ndba');
145 | insert into author values(28, 'ndbb');
146 | insert into author values(29, 'ndbc');
147 | insert into author values(30, 'ndbd');
148 | insert into author values(31, 'ndbe');
149 | insert into author values(32, 'ndbf');
150 | insert into author values(33, 'ndbg');
151 | insert into author values(34, 'ndbh');
152 | insert into author values(35, 'ndbi');
153 | insert into author values(36, 'ndbj');
154 | insert into author values(37, 'ndbk');
155 | insert into author values(38, 'ndbl');
156 |
157 | insert into author values(1, 'neaa');
158 | insert into author values(2, 'neab');
159 | insert into author values(3, 'neac');
160 | insert into author values(4, 'nead');
161 | insert into author values(5, 'neae');
162 | insert into author values(6, 'neaf');
163 | insert into author values(7, 'neag');
164 | insert into author values(8, 'neah');
165 | insert into author values(9, 'neai');
166 | insert into author values(10,'neaj');
167 | insert into author values(11,'neak');
168 | insert into author values(12,'neal');
169 | insert into author values(13,'neam');
170 | insert into author values(14,'nean');
171 | insert into author values(15,'neao');
172 | insert into author values(16,'neap');
173 | insert into author values(17,'neaq');
174 | insert into author values(18,'near');
175 | insert into author values(19,'neas');
176 | insert into author values(20,'neat');
177 | insert into author values(21,'neau');
178 | insert into author values(22,'neav');
179 | insert into author values(23,'neaw');
180 | insert into author values(24,'neax');
181 | insert into author values(25,'neay');
182 | insert into author values(26,'neaz');
183 | insert into author values(27, 'neba');
184 | insert into author values(28, 'nebb');
185 | insert into author values(29, 'nebc');
186 | insert into author values(30, 'nebd');
187 | insert into author values(31, 'nebe');
188 | insert into author values(32, 'nebf');
189 | insert into author values(33, 'nebg');
190 | insert into author values(34, 'nebh');
191 | insert into author values(35, 'nebi');
192 | insert into author values(36, 'nebj');
193 | insert into author values(37, 'nebk');
194 | insert into author values(38, 'nebl');
195 |
196 | insert into author values(1, 'nfaa');
197 | insert into author values(2, 'nfab');
198 | insert into author values(3, 'nfac');
199 | insert into author values(4, 'nfad');
200 | insert into author values(5, 'nfae');
201 | insert into author values(6, 'nfaf');
202 | insert into author values(7, 'nfag');
203 | insert into author values(8, 'nfah');
204 | insert into author values(9, 'nfai');
205 | insert into author values(10,'nfaj');
206 | insert into author values(11,'nfak');
207 | insert into author values(12,'nfal');
208 | insert into author values(13,'nfam');
209 | insert into author values(14,'nfan');
210 | insert into author values(15,'nfao');
211 | insert into author values(16,'nfap');
212 | insert into author values(17,'nfaq');
213 | insert into author values(18,'nfar');
214 | insert into author values(19,'nfas');
215 | insert into author values(20,'nfat');
216 | insert into author values(21,'nfau');
217 | insert into author values(22,'nfav');
218 | insert into author values(23,'nfaw');
219 | insert into author values(24,'nfax');
220 | insert into author values(25,'nfay');
221 | insert into author values(26,'nfaz');
222 | insert into author values(27, 'nfba');
223 | insert into author values(28, 'nfbb');
224 | insert into author values(29, 'nfbc');
225 | insert into author values(30, 'nfbd');
226 | insert into author values(31, 'nfbe');
227 | insert into author values(32, 'nfbf');
228 | insert into author values(33, 'nfbg');
229 | insert into author values(34, 'nfbh');
230 | insert into author values(35, 'nfbi');
231 | insert into author values(36, 'nfbj');
232 | insert into author values(37, 'nfbk');
233 | insert into author values(38, 'nfbl');
234 |
235 | insert into author values(1, 'ngaa');
236 | insert into author values(2, 'ngab');
237 | insert into author values(3, 'ngac');
238 | insert into author values(4, 'ngad');
239 | insert into author values(5, 'ngae');
240 | insert into author values(6, 'ngaf');
241 | insert into author values(7, 'ngag');
242 | insert into author values(8, 'ngah');
243 | insert into author values(9, 'ngai');
244 | insert into author values(10,'ngaj');
245 | insert into author values(11,'ngak');
246 | insert into author values(12,'ngal');
247 | insert into author values(13,'ngam');
248 | insert into author values(14,'ngan');
249 | insert into author values(15,'ngao');
250 | insert into author values(16,'ngap');
251 | insert into author values(17,'ngaq');
252 | insert into author values(18,'ngar');
253 | insert into author values(19,'ngas');
254 | insert into author values(20,'ngat');
255 | insert into author values(21,'ngau');
256 | insert into author values(22,'ngav');
257 | insert into author values(23,'ngaw');
258 | insert into author values(24,'ngax');
259 | insert into author values(25,'ngay');
260 | insert into author values(26,'ngaz');
261 | insert into author values(27, 'ngba');
262 | insert into author values(28, 'ngbb');
263 | insert into author values(29, 'ngbc');
264 | insert into author values(30, 'ngbd');
265 | insert into author values(31, 'ngbe');
266 | insert into author values(32, 'ngbf');
267 | insert into author values(33, 'ngbg');
268 | insert into author values(34, 'ngbh');
269 | insert into author values(35, 'ngbi');
270 | insert into author values(36, 'ngbj');
271 | insert into author values(37, 'ngbk');
272 | insert into author values(38, 'ngbl');
273 |
274 | insert into author values(1, 'nhaa');
275 | insert into author values(2, 'nhab');
276 | insert into author values(3, 'nhac');
277 | insert into author values(4, 'nhad');
278 | insert into author values(5, 'nhae');
279 | insert into author values(6, 'nhaf');
280 | insert into author values(7, 'nhag');
281 | insert into author values(8, 'nhah');
282 | insert into author values(9, 'nhai');
283 | insert into author values(10,'nhaj');
284 | insert into author values(11,'nhak');
285 | insert into author values(12,'nhal');
286 | insert into author values(13,'nham');
287 | insert into author values(14,'nhan');
288 | insert into author values(15,'nhao');
289 | insert into author values(16,'nhap');
290 | insert into author values(17,'nhaq');
291 | insert into author values(18,'nhar');
292 | insert into author values(19,'nhas');
293 | insert into author values(20,'nhat');
294 | insert into author values(21,'nhau');
295 | insert into author values(22,'nhav');
296 | insert into author values(23,'nhaw');
297 | insert into author values(24,'nhax');
298 | insert into author values(25,'nhay');
299 | insert into author values(26,'nhaz');
300 | insert into author values(27, 'nhba');
301 | insert into author values(28, 'nhbb');
302 | insert into author values(29, 'nhbc');
303 | insert into author values(30, 'nhbd');
304 | insert into author values(31, 'nhbe');
305 | insert into author values(32, 'nhbf');
306 | insert into author values(33, 'nhbg');
307 | insert into author values(34, 'nhbh');
308 | insert into author values(35, 'nhbi');
309 | insert into author values(36, 'nhbj');
310 | insert into author values(37, 'nhbk');
311 | insert into author values(38, 'nhbl');
312 |
313 | insert into author values(1, 'niaa');
314 | insert into author values(2, 'niab');
315 | insert into author values(3, 'niac');
316 | insert into author values(4, 'niad');
317 | insert into author values(5, 'niae');
318 | insert into author values(6, 'niaf');
319 | insert into author values(7, 'niag');
320 | insert into author values(8, 'niah');
321 | insert into author values(9, 'niai');
322 | insert into author values(10,'niaj');
323 | insert into author values(11,'niak');
324 | insert into author values(12,'nial');
325 | insert into author values(13,'niam');
326 | insert into author values(14,'nian');
327 | insert into author values(15,'niao');
328 | insert into author values(16,'niap');
329 | insert into author values(17,'niaq');
330 | insert into author values(18,'niar');
331 | insert into author values(19,'nias');
332 | insert into author values(20,'niat');
333 | insert into author values(21,'niau');
334 | insert into author values(22,'niav');
335 | insert into author values(23,'niaw');
336 | insert into author values(24,'niax');
337 | insert into author values(25,'niay');
338 | insert into author values(26,'niaz');
339 | insert into author values(27, 'niba');
340 | insert into author values(28, 'nibb');
341 | insert into author values(29, 'nibc');
342 | insert into author values(30, 'nibd');
343 | insert into author values(31, 'nibe');
344 | insert into author values(32, 'nibf');
345 | insert into author values(33, 'nibg');
346 | insert into author values(34, 'nibh');
347 | insert into author values(35, 'nibi');
348 | insert into author values(36, 'nibj');
349 | insert into author values(37, 'nibk');
350 | insert into author values(38, 'nibl');
351 |
352 | insert into author values(1, 'njaa');
353 | insert into author values(2, 'njab');
354 | insert into author values(3, 'njac');
355 | insert into author values(4, 'njad');
356 | insert into author values(5, 'njae');
357 | insert into author values(6, 'njaf');
358 | insert into author values(7, 'njag');
359 | insert into author values(8, 'njah');
360 | insert into author values(9, 'njai');
361 | insert into author values(10,'njaj');
362 | insert into author values(11,'njak');
363 | insert into author values(12,'njal');
364 | insert into author values(13,'njam');
365 | insert into author values(14,'njan');
366 | insert into author values(15,'njao');
367 | insert into author values(16,'njap');
368 | insert into author values(17,'njaq');
369 | insert into author values(18,'njar');
370 | insert into author values(19,'njas');
371 | insert into author values(20,'njat');
372 | insert into author values(21,'njau');
373 | insert into author values(22,'njav');
374 | insert into author values(23,'njaw');
375 | insert into author values(24,'njax');
376 | insert into author values(25,'njay');
377 | insert into author values(26,'njaz');
378 | insert into author values(27, 'njba');
379 | insert into author values(28, 'njbb');
380 | insert into author values(29, 'njbc');
381 | insert into author values(30, 'njbd');
382 | insert into author values(31, 'njbe');
383 | insert into author values(32, 'njbf');
384 | insert into author values(33, 'njbg');
385 | insert into author values(34, 'njbh');
386 | insert into author values(35, 'njbi');
387 | insert into author values(36, 'njbj');
388 | insert into author values(37, 'njbk');
389 | insert into author values(38, 'njbl');
390 |
391 | insert into author values(1, 'nkaa');
392 | insert into author values(2, 'nkab');
393 | insert into author values(3, 'nkac');
394 | insert into author values(4, 'nkad');
395 | insert into author values(5, 'nkae');
396 | insert into author values(6, 'nkaf');
397 | insert into author values(7, 'nkag');
398 | insert into author values(8, 'nkah');
399 | insert into author values(9, 'nkai');
400 | insert into author values(10,'nkaj');
401 | insert into author values(11,'nkak');
402 | insert into author values(12,'nkal');
403 | insert into author values(13,'nkam');
404 | insert into author values(14,'nkan');
405 | insert into author values(15,'nkao');
406 | insert into author values(16,'nkap');
407 | insert into author values(17,'nkaq');
408 | insert into author values(18,'nkar');
409 | insert into author values(19,'nkas');
410 | insert into author values(20,'nkat');
411 | insert into author values(21,'nkau');
412 | insert into author values(22,'nkav');
413 | insert into author values(23,'nkaw');
414 | insert into author values(24,'nkax');
415 | insert into author values(25,'nkay');
416 | insert into author values(26,'nkaz');
417 | insert into author values(27, 'nkba');
418 | insert into author values(28, 'nkbb');
419 | insert into author values(29, 'nkbc');
420 | insert into author values(30, 'nkbd');
421 | insert into author values(31, 'nkbe');
422 | insert into author values(32, 'nkbf');
423 | insert into author values(33, 'nkbg');
424 | insert into author values(34, 'nkbh');
425 | insert into author values(35, 'nkbi');
426 | insert into author values(36, 'nkbj');
427 | insert into author values(37, 'nkbk');
428 | insert into author values(38, 'nkbl');
429 |
430 | insert into author values(1, 'nlaa');
431 | insert into author values(2, 'nlab');
432 | insert into author values(3, 'nlac');
433 | insert into author values(4, 'nlad');
434 | insert into author values(5, 'nlae');
435 | insert into author values(6, 'nlaf');
436 | insert into author values(7, 'nlag');
437 | insert into author values(8, 'nlah');
438 | insert into author values(9, 'nlai');
439 | insert into author values(10,'nlaj');
440 | insert into author values(11,'nlak');
441 | insert into author values(12,'nlal');
442 | insert into author values(13,'nlam');
443 | insert into author values(14,'nlan');
444 | insert into author values(15,'nlao');
445 | insert into author values(16,'nlap');
446 | insert into author values(17,'nlaq');
447 | insert into author values(18,'nlar');
448 | insert into author values(19,'nlas');
449 | insert into author values(20,'nlat');
450 | insert into author values(21,'nlau');
451 | insert into author values(22,'nlav');
452 | insert into author values(23,'nlaw');
453 | insert into author values(24,'nlax');
454 | insert into author values(25,'nlay');
455 | insert into author values(26,'nlaz');
456 | insert into author values(27, 'nlba');
457 | insert into author values(28, 'nlbb');
458 | insert into author values(29, 'nlbc');
459 | insert into author values(30, 'nlbd');
460 | insert into author values(31, 'nlbe');
461 | insert into author values(32, 'nlbf');
462 | insert into author values(33, 'nlbg');
463 | insert into author values(34, 'nlbh');
464 | insert into author values(35, 'nlbi');
465 | insert into author values(36, 'nlbj');
466 | insert into author values(37, 'nabk');
467 | insert into author values(38, 'nabl');
468 |
469 | insert into author values(1, 'nmaa');
470 | insert into author values(2, 'nmab');
471 | insert into author values(3, 'nmac');
472 | insert into author values(4, 'nmad');
473 | insert into author values(5, 'nmae');
474 | insert into author values(6, 'nmaf');
475 | insert into author values(7, 'nmag');
476 | insert into author values(8, 'nmah');
477 | insert into author values(9, 'nmai');
478 | insert into author values(10,'nmaj');
479 | insert into author values(11,'nmak');
480 | insert into author values(12,'nmal');
481 | insert into author values(13,'nmam');
482 | insert into author values(14,'nman');
483 | insert into author values(15,'nmao');
484 | insert into author values(16,'nmap');
485 | insert into author values(17,'nmaq');
486 | insert into author values(18,'nmar');
487 | insert into author values(19,'nmas');
488 | insert into author values(20,'nmat');
489 | insert into author values(21,'nmau');
490 | insert into author values(22,'nmav');
491 | insert into author values(23,'nmaw');
492 | insert into author values(24,'nmax');
493 | insert into author values(25,'nmay');
494 | insert into author values(26,'nmaz');
495 | insert into author values(27, 'nmba');
496 | insert into author values(28, 'nmbb');
497 | insert into author values(29, 'nmbc');
498 | insert into author values(30, 'nmbd');
499 | insert into author values(31, 'nmbe');
500 | insert into author values(32, 'nmbf');
501 | insert into author values(33, 'nmbg');
502 | insert into author values(34, 'nmbh');
503 | insert into author values(35, 'nmbi');
504 | insert into author values(36, 'nmbj');
505 | insert into author values(37, 'nmbk');
506 | insert into author values(38, 'nmbl');
507 |
--------------------------------------------------------------------------------