What is SQLite?
SQLite is a relational database management system which is self-contained, server-less and need zero configuration.
What are the most important features of SQLite?
There are lots of features which make SQLite very popular:
- SQLite is free of cost
- Server-less
- Flexible
- SQLite doesn’t need configuration
- Cross-platform
- Null handling
- Blob storage
- Autoincrement
- Multi Threaded programs in SQLite
- Error and warning Log
- Backup API
- Limits in SQLite
- Memory Mapped I/o
- Foreign Key Support
- 8+3 filenames
- URL filenames
- Partial indexes
- Unlock Notify
- WAL mode
- Shared catch Mode
- Without ROWID tables
What are the advantages of using SQLite?
- SQLite is very light weight database.
- Data storing is very easy and efficient.
- SQLite is very easy to learn and use.
How would you create a database in SQLite?
In SQLite, sqlite3 command is used to create database.
Syntax:
Sqlite3 database_name.dbÂ
How would you create a table in SQLite database?
CREATE TABLE statement is used to create a table in SQLite database. You have to define the columns and data types of each column while creating the table.
How would you drop a table in SQLite database?
DROP TABLE command is used to delete or permanently drop a table from SQLite database.
How would you create an AUTOINCREMENT field?
For autoincrement, you have to declare a column of the table to be INTEGER PRIMARY KEY, then whenever you insert a NULL into that column of the table, the NULL is automatically converted into an integer which is one greater than the largest value of that column over all other rows in the table, or 1 if the table is empty.
What data types are supported by SQLite?
SQLite uses dynamic typing. Content can be stored as INTEGER, REAL, TEXT, BLOB, or as NULL.
How would you retrieve data from SQLite table?
The SELECT command is used to retrieve data from SQLite table. If you want to retrieve all columns from the table use SELECT * otherwise use the specific column’s name separated by commas.
What is the use of UPDATE query in SQLite?
The UPDATE query is used to modify the existing records in the SQLite table. You have to use the WHERE clause to modify a specific row otherwise all rows will be updated.
How can you delete the existing records from a table in SQLite?
In SQLite, DELETE command is used to delete the existing records from a table. You should use the WHERE clause to choose the specific row otherwise all rows will be deleted.
What is the use of WHERE clause in CRUD statements?
WHERE clause is used to refer a specific row where the CRUD operation is executed. Without using WHERE clause all the rows will be affected.
What is the usage of AND & OR operators with WHERE clause?
AND & OR operators are used with WHERE clause to combine two or more than two conditions together.
What is the use of LIMIT clause with SELECT query?
LIMIT clause is used with SELECT statement when we want a limited number of fetched records.
Why is ORDER BY clause used with SELECT statement?
The ORDER BY clause is used to sort the fetched data in a specific order either ascending or descending.
What is SQLite JOIN? How many types of JOINS are supported in SQLite?
SQLite JOIN clause is used to combine two or more tables in a database. It combines the table by using the common values of the both table.
There are mainly three types of JOINS supported in SQlite:
- SQLite INNER JOIN
- SQLite OUTER JOIN
- SQLite CROSS JOIN
What is SQLite INNER JOIN?
SQLite INNER JOIN is simplest and most common join. It combines all rows from both tables where the condition is satisfied.
What is SQLite OUTER JOIN?
There are three types of OUTER JOINS:
- Left outer join
- Right outer join
- Full outer join
But SQLite only supports left outer join. The SQLite left outer join returns all rows from left table and only those rows from the right table where the join condition is satisfied.
What is SQLite CROSS JOIN?
The SQLite Cross join is used to match every rows of the first table with every rows of the second table. If the first table contains x columns and second table contains y columns then the resultant Cross join table will contain the x*y columns.
What is SQLite date and time () function?
SQLite date and time () functions are used to retrieve current date and time and also do calculations on the dates and time.
There are mainly 6 types of date and time () function in SQLite:
- SQLite date() Function
- SQLite datetime() Function
- SQLite julianday() Function
- SQLite now() Function
- SQLite strftime() Function
- SQLite time() Function
What is SQLite julianday() function?
A Julian Day is the number of days since Nov 24, 4714 BC 12:00pm Greenwich time in the Gregorian calendar. So, the julianday() function is used to return number of days since Nov 24, 4714 BC 12:00pm.
What is the use of SQLite now() function?
SQLite now is not a function. Instead of this, it is a timestring parameter which is used to fetch current date and time.
What is the usage of SQLite strftime() function?
SQLite strftime() function is used to fetch date and time and also perform time and date calculation.
What is the use of SQLite time() function?
SQLite time() function is used to fetch current time in ‘HH-MM-SS’ format.
What do you understand by SQLite aggregate functions?
SQLite aggregate functions are the type of functions where values of multiple rows are grouped together as input on certain criteria and form a single value as output.
What is SQLite MIN aggregate function?
SQLite MIN aggregate function is used to retrieve the minimum value of the expression.
What is SQLite MAX aggregate function?
SQLite MAX aggregate function is used to fetch the maximum value of an expression.