changed sql, added diagram and sql code