Search
 
SCRIPT & CODE EXAMPLE
 

SQL

ring SQLite create a SQLite database, add new records then display the data

load "sqlitelib.ring"

oSQLite = sqlite_init()

sqlite_open(oSQLite,"mytest.db")

sql = "
         CREATE TABLE COMPANY (
         ID INT PRIMARY KEY     NOT NULL,
         NAME           TEXT    NOT NULL,
         AGE            INT     NOT NULL,
         ADDRESS        CHAR(50),
         SALARY         REAL );
"
sqlite_execute(oSQLite,sql)

sql = "
        INSERT INTO COMPANY (ID,NAME,AGE,ADDRESS,SALARY)
        VALUES  (1, 'Mahmoud' , 29, 'Jeddah', 20000.00 ),
                (2, 'Ahmed'   , 27, 'Jeddah', 15000.00 ),
                (3, 'Mohammed', 31, 'Egypt' , 20000.00 ),
                (4, 'Ibrahim' , 24, 'Egypt ', 65000.00 );
"

sqlite_execute(oSQLite,sql)

aResult =  sqlite_execute(oSQLite,"select * from COMPANY")
for x in aResult
        for t in x
                ? t[2] + nl
        next
next
? copy("*",50)
for x in aResult
        ? x[:name]
next
sqlite_close(oSQLite)
Comment

PREVIOUS NEXT
Code Example
Sql :: mysql start of today 
Sql :: format datetime mysql 
Sql :: postgresql get tables where column is foreign key 
Sql :: partitioning in oracle-base 
Sql :: sql count and addition by day 
Sql :: insert data 
Sql :: sql queries questions 
Sql :: Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 
Sql :: correlated subquery 
Sql :: oracle foreign key reference table 
Sql :: how to query a db sqlite3 database in django python 
Sql :: sql check if a record exists 
Sql :: change order of sql columns 
Sql :: where sqlalchemy 
Sql :: pl sql round 
Sql :: guid string to binary better 
Csharp :: unity next scene 
Csharp :: unity load current scene 
Csharp :: unity how to convert mouse screen position to world position 
Csharp :: Changing datagridview cell color dynamically 
Csharp :: asp.net core multiple get methods 
Csharp :: unity get mouse position 
Csharp :: c# check to see if dictionary key exists 
Csharp :: get max enum value c# 
Csharp :: c# play sound 
Csharp :: dotnet executable directory 
Csharp :: c# datagridview hide column 
Csharp :: new Color from hex in unity 
Csharp :: c# count number of occurrences in string 
Csharp :: get random file in directory c# 
ADD CONTENT
Topic
Content
Source link
Name
5+7 =