Skip to content

Commit

Permalink
b3 updated
Browse files Browse the repository at this point in the history
  • Loading branch information
renkun-ken committed Apr 3, 2014
1 parent 8d3fb22 commit 313fdf9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Binary file added data/namelist.xlsx
Binary file not shown.
24 changes: 16 additions & 8 deletions src/b3.database.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Database

## SQL
# http://www.w3schools.com/sql/



## Excel Worksheet
library(RODBC)
conn <- odbcConnectExcel2007("data/namelist.xlsx",readOnly = TRUE)
students <- sqlFetch(conn,"Students")
grades <- sqlQuery(conn,"SELECT * FROM [Grades$]")
df <- sqlQuery(conn,"SELECT * FROM [Students$] INNER JOIN [Grades$] ON [Grades$].Name = [Students$].Name")
odbcClose(conn)


## SQLite database
# http://www.sqlite.org/
require(RSQLite)
Expand All @@ -24,21 +38,15 @@ dbWriteTable(conn,"products",products.df)
products.A <- dbGetQuery(conn,"SELECT * FROM products WHERE type='A'")
dbDisconnect(conn)


## Operating SQLite database
require(RSQLite)
conn <- dbConnect(SQLite(),"data/example.local.sqlite")
products.A <- dbGetQuery(conn,"SELECT * FROM products WHERE type='A'")
products.subset <- dbGetQuery(conn,"SELECT i,class,x+y AS z FROM products WHERE type='A' AND x>=8")
dbDisconnect(conn)

## Querying SQLite database

### SQL


### SQL in R
require(RSQLite)

### Managing SQLite database

## Managing SQLite database
### Using SQLite Expert

0 comments on commit 313fdf9

Please sign in to comment.