首页 > 代码库 > Working with Data Sources 7
Working with Data Sources 7
1.Working with dates in SQL: in SQL query, we can select date by using where. < means before that date, and > means after that date:
SELECT * FROM facts WHERE updated_at > "2015-10-30 16:00" and updated_at <"2015-11-02 15:00";
2. PRAGMA table_info(table_name) return the table info(data type) of each column :
pragma table_info(facts) #The result will be a list.
3. We can insert a row of data into a table by using INSERT INTO ... values, we can also insert null data into a column if the column is not specific to nonnull type:
insert into facts values (262, "dq", "DataquestLand", 60000, 40000, 20000, 500000, 100, 50, 10, 20, "2016-02-25 12:00:00", "2016-02-25 12:00:00") # The number data in the value have to match the data of column in the table
4. We can update data in the specific row or column by using UPDATE...SET:
update facts
set name = "United"
where name = "Dataquestland"
5. Delete rows of data by using delete from functoin:
Delete from facts where name = ‘Canada‘
6.
Working with Data Sources 7