Creating a Database,inserting,deleting from SQLite - My articles - Publisher - Information Technology
Saturday, 2016-12-03, 10:46 PM
ebooks Programming Computer Science
Welcome Guest | RSS
Site menu
Section categories
My articles [23]
Main » Articles » My articles

Creating a Database,inserting,deleting from SQLite
SQLite version 3.7.12.1 2012-05-22 02:45:53
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>  create table employees (employee_id int(10),name varchar( );
Error: near ")": syntax error
sqlite> create table employees (employee_id int(10),name varchar( );
Error: near ")": syntax error
sqlite> create table employees (employee_id int(10),
   ...> name varchar(25), dob varchar(10), salary double,
   ...> address varchar (50));
sqlite> create table department (dept_id int(2),
   ...> dept_name varchar(15), dept_manager varchar (25));
sqlite> create table employee_dept (dept_id int(2),
   ...> employee_id int(10));
sqlite> insert into employees (123, "Some Guy", "10/10/1998",
   ...>  1000, "147 pagla garod");
Error: near "123": syntax error
sqlite>  insert into employees values (123, "Some Guy",
   ...>    ...> "10/10/1998", 1000, "Pagla Garod");
Error: near ".": syntax error
sqlite> sqlite> insert into employees values (222, "Some Dudette",
   ...>    ...> "09/09/1972", 1200, "123 janina");
Error: near "sqlite": syntax error
sqlite> sqlite> insert into employees values (333, "Crazy one",
   ...>    ...> "09/09/1998", 1100, "123 janina");
Error: near "sqlite": syntax error
sqlite> sqlite> ALTER TABLE department MODIFY dept_id int(3);
Error: near "sqlite": syntax error
sqlite> Error: near "MODIFY": syntax error
   ...> sqlite> ALTER TABLE department MODIFY COLUMN dept_id int(3);
Error: near "Error": syntax error
sqlite> Error: near "MODIFY": syntax error
   ...> sqlite> ALTER TABLE department dept_id int(3);
Error: near "Error": syntax error
sqlite> Error: near "dept_id": syntax error
   ...> sqlite> ALTER TABLE department dept_id int(3);
Error: near "Error": syntax error
sqlite> Error: near "dept_id": syntax error
   ...> sqlite> insert into department values (11, "Lungi",
   ...>    ...> "Mr. Lungi");
Error: near "Error": syntax error
sqlite> sqlite> insert into department values (22, "Genji",
   ...>    ...> "Mr. Genji");
Error: near "sqlite": syntax error
sqlite> sqlite> insert into department values (33, "Tupi",
   ...>    ...> "Mr. Cowboy");
Error: near "sqlite": syntax error
sqlite> sqlite> insert into department values (44, "Juta",
   ...>    ...> "Ms. Boss Lady");
Error: near "sqlite": syntax error
sqlite> sqlite> insert into department values (55, "Muja",
   ...>    ...> "Ms. Muja Boy");
Error: near "sqlite": syntax error
sqlite> sqlite> insert into employee_dept values(11, 123);
Error: near "sqlite": syntax error
sqlite> sqlite> insert into employee_dept values(11, 222);
Error: near "sqlite": syntax error
sqlite> sqlite> insert into employee_dept values(22, 222);
Error: near "sqlite": syntax error
sqlite> sqlite> insert into employee_dept values(55, 333);
Error: near "sqlite": syntax error
sqlite> sqlite> insert into employee_dept values(44, 222);
Error: near "sqlite": syntax error
sqlite> sqlite> select * from employees where salary > 1000;
Error: near "sqlite": syntax error
sqlite> 222|Some Dudette|09/09/1972|1200.0|123 janina
   ...> 333|Crazy one|09/09/1998|1100.0|123 janina
   ...> sqlite> select * from employees where dob > "06/06/1998";
Error: near "222": syntax error
sqlite> 123|Some Guy|10/10/1998|1000.0|Pagla Garod
   ...> 222|Some Dudette|09/09/1972|1200.0|123 janina
   ...> 333|Crazy one|09/09/1998|1100.0|123 janina
   ...> sqlite> select * from employees where salary > 1150;
Error: near "123": syntax error
sqlite> 222|Some Dudette|09/09/1972|1200.0|123 janina
   ...> sqlite> delete from depertment where dept_id=33;
Error: near "222": syntax error
sqlite> Error: no such table: depertment
   ...> sqlite> delete from department where dept_id=33;
Error: near "Error": syntax error
sqlite> sqlite> select * from department;
Error: near "sqlite": syntax error
sqlite> 11|Lungi|Mr. Lungi
   ...> 22|Genji|Mr. Genji
   ...> 44|Juta|Ms. Boss Lady
   ...> 55|Muja|Ms. Muja Boy
   ...> sqlite> select * from employees, department where
   ...>    ...> employees.employee_id=department.empoyee_id
   ...>    ...> and department.dept_manager="Ms. Boss Lady";
Error: near "11": syntax error
sqlite> Error: no such column: department.empoyee_id
   ...> sqlite> select * from employees, department, employee_dept where
   ...>    ...> employees.employee_id=employee_dept.employee_id
   ...>    ...> and
   ...>    ...>
   ...>    ...> ;
Error: near "Error": syntax error
sqlite> Error: near ";": syntax error
   ...> sqlite>
   ...> sqlite> alter table employees add column dept_id int(2);
Error: near "Error": syntax error
sqlite> sqlite> select * employees;
Error: near "sqlite": syntax error
sqlite> Error: near "employees": syntax error
   ...> sqlite> select * from  employees;
Error: near "Error": syntax error
sqlite> 123|Some Guy|10/10/1998|1000.0|Pagla Garod|
   ...> 222|Some Dudette|09/09/1972|1200.0|123 janina|
   ...> 333|Crazy one|09/09/1998|1100.0|123 janina|
   ...> sqlite> .headers on;
Error: near "123": syntax error
sqlite> sqlite> select * from  employees;
Error: near "sqlite": syntax error
sqlite> 123|Some Guy|10/10/1998|1000.0|Pagla Garod|
   ...> 222|Some Dudette|09/09/1972|1200.0|123 janina|
   ...> 333|Crazy one|09/09/1998|1100.0|123 janina|
   ...> sqlite> .headers on
   ...> sqlite> select * from  employees;
Error: near "123": syntax error
sqlite> employee_id|name|dob|salary|address|dept_id
   ...> 123|Some Guy|10/10/1998|1000.0|Pagla Garod|
   ...> 222|Some Dudette|09/09/1972|1200.0|123 janina|
   ...> 333|Crazy one|09/09/1998|1100.0|123 janina|
   ...> sqlite> update employees set dept_id=11 where employee_id=123;
Error: near "employee_id": syntax error
sqlite> sqlite> select * from  employees;
Error: near "sqlite": syntax error
sqlite> employee_id|name|dob|salary|address|dept_id
   ...> 123|Some Guy|10/10/1998|1000.0|Pagla Garod|11
   ...> 222|Some Dudette|09/09/1972|1200.0|123 janina|
   ...> 333|Crazy one|09/09/1998|1100.0|123 janina|
   ...> sqlite> update employees set dept_id=11 where employee_id=222;
Error: near "employee_id": syntax error
sqlite> sqlite> update employees set dept_id=55 where employee_id=333;
Error: near "sqlite": syntax error
sqlite> sqlite> select * from  employees;
Error: near "sqlite": syntax error
sqlite> employee_id|name|dob|salary|address|dept_id
   ...> 123|Some Guy|10/10/1998|1000.0|Pagla Garod|11
   ...> 222|Some Dudette|09/09/1972|1200.0|123 janina|11
   ...> 333|Crazy one|09/09/1998|1100.0|123 janina|55
   ...> sqlite> select * from employees, department were
   ...>    ...> employees.dept_id=department.dept_id and
   ...>    ...> department.dept_manager="Ms. Boss Lady";
Error: near "employee_id": syntax error
sqlite> Error: near "employees": syntax error
   ...> sqlite> select * from employees, department where
   ...>    ...> employees.dept_id=department.dept_id and
   ...>    ...> department.dept_manager="Ms. Boss Lady";
Error: near "Error": syntax error
sqlite> sqlite> select * from employees, department where
   ...>    ...> employees.dept_id=department.dept_id and
   ...>    ...> department.dept_manager="Mr. Genji";
Error: near "sqlite": syntax error
sqlite> sqlite> select * from employees, department where
   ...>    ...> employees.dept_id=department.dept_id and
   ...>    ...> department.dept_manager="Mr. Lungi Man";
Error: near "sqlite": syntax error
sqlite> sqlite> select * from employees, department where
   ...>    ...> employees.dept_id=department.dept_id and
   ...>    ...> department.dept_manager="Mr. Lungi";
Error: near "sqlite": syntax error
sqlite> employee_id|name|dob|salary|address|dept_id|dept_id|dept_name|dept_manag
er
   ...> 123|Some Guy|10/10/1998|1000.0|Pagla Garod|11|11|Lungi|Mr. Lungi
   ...> 222|Some Dudette|09/09/1972|1200.0|123 janina|11|11|Lungi|Mr. Lungi
   ...> sqlite>
   ...>
   ...>
   ...>
   ...>    ...> department.dept_manager="Ms. Boss Lady";
Category: My articles | Added by: Sumrat (2012-08-12)
Views: 1471 | Rating: 0.0/0
Total comments: 0
Name *:
Email *:
Code *:
Our poll
Rate my site
Total of answers: 152
Statistics

Total online: 1
Guests: 1
Users: 0
Login form