private void create(Create query) throws IOException, Error, ClassNotFoundException{
		Hashtable<String, Table> tables = null;
		File tableFile = new File(databaseDefUrl);
		if(tableFile.exists()){
			tables = this.getTableDef();
		}else{
			tables = new Hashtable<String, Table>();
		}
		//Check if it already has a table
		if(tables.get(query.getTableName()) != null){
			throw new Error("CREATE TABLE: Table " + query.getTableName() + " already exists");
		}

		//Check foreign table constraints
		Hashtable<String, ForeignReferences> foreignTable = query.getReferences();
		if(foreignTable.size() != 0){
			for(String attrName : foreignTable.keySet()){
				Table table;
				String tableName = foreignTable.get(attrName).getTableName();

				if( (table = tables.get(tableName)) == null){
					throw new Error("CREATE TABLE: Foreign Table " + tableName + " does not exists"); 
				}
			
				String foreignAttrName = foreignTable.get(attrName).getAttrName();

				int attrPos;
				if((attrPos = table.getAttrPos(foreignAttrName)) == -1){
					throw new Error("CREATE TABLE: Foreign constraints attribute " + foreignAttrName + " does not contains in the Table " + tableName );
				}

				Attribute.Type foreignAttrType = table.getAttrList().get(attrPos).getType();

				int currentAttrPos = query.getAttrPos(attrName);
				Attribute.Type currentAttrType = query.getAttributes().get(currentAttrPos).getType();

				if(foreignAttrType != currentAttrType){
					throw new Error("CREATE TABLE: Foreign constraints attribute " + foreignAttrName + " has a type that different from " + attrName);
				}

			}
		}

		//Write table definition to the databaseDef.dat
		tables.put(query.getTableName(), query.getTable());
		this.writeTableDef(tableFile, tables);	
		System.out.println("Table created successfully");
	}