Transferring data from different database systems is quite easy, as they all have similar SQL language. They have a large amount of features which are lacking from SQLite, but on the other hand their installation and often usage is more difficult. Widely used open database systems are MySQL and PostgreSQL. SQLite is a valid choice for learning SQL, but it does have some restrictions, which can cause problems in actual programs. You can try the basic functions of SQL with SQLite, and we will use it with some of the examples during this course. SQLite is a simple and openly availabe database system, which is suitable for learning SQL. Notice the difference between WHERE and HAVING: WHERE limits the rows before grouping, whereas HAVING limits after the grouping. For example the following command adds a row into the table Products we just created The command INSERT adds a new row into the table. For example in SQLite database INTEGER PRIMARY KEY column automatically gets a sequential numbering. The implementation of this depends on the database management system. This means that when we add rows to the table, the first row gets automatically id value of 1, second gets id value of 2, and so on. We usually want the id to have a sequential numbering. In practice, a common way for a primary key is an id column with integer type. The primary key can be any column or combination of columns, which is unique to each row. This means it creates an identification for each row in the table and with it we can easily refer to any row. The column id is also the primary key (PRIMARY KEY) for the table. In this table the columns id and price are integers (INTEGER) and the column nameis a string (TEXT). Common practice (at least for this course) is, that the tables are written with capital first letter and in plural, and columns with small first letter and in singular form.įor each column, along with the name we declare the desired type. We can name the table and the columns the way we want. CREATE TABLE Products ( id INTEGER PRIMARY KEY, name TEXT, price INTEGER )
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |