In the above example, we use a join constraint to generate the csv file from two different tables that are the comp_worker and worker_details, that we already created. Select worker_name, worker_address, worker_pincode, worker_salary from comp_worker as cw inner join worker_details as wd on cw.worker_id = wd.worker_id order by worker_name Now we have records in both tables now, let’s see how we can export both tables into the csv file by using the join as follows.įirst, perform the same command as the above example. Now insert some records for implementation as follows. Now let’s see how we can use join in export as follows.įirst, create another table by using the following statement as follows.Ĭreate table worker_details(dept_id integer primary key, worker_pincode text not null, worker_id text) In the below screenshot it shows where the csv file is created as follows. Now check the sampl.csv file in the SQLite folder and print something like the below screenshot. In the above statement, we use a select clause to write the data into the csv file from the comp_worker table and finally execute the dot quite command (.quit). Select worker_id, worker_name, worker_age, worker_address, worker_salary from comp_worker: Now use SQL statement to write the data into the csv file by using the following SQL statement as follows.
Now assign some names to the csv file by using the following command as follows. Now we can perform the export operation as follows.įirst, we need to enable the header by using the following dot command as follows.Īfter that, we set the mode of the export mode CSV file by using the following dot command as follows. The end output of the above statement we illustrate by using the following screenshot as follows. In the above statement, we use to insert it into the statement. Now insert some record for function implementation by using the following insert into the statement as follows. In the above example, we use the create table statement to create a new table name as comp_worker with different attributes such as worder_id, worker_name, worker_age, worker_address, and worker_salary with different data types as shown in the above example. Now let’s see the different examples of export to csv for better understanding as follows.įirst, we need to create the new table by using the following statement as follows.Ĭreate table comp_worker(worker_id integer primary key, worker_name text not null, worker_age text, worker_address text, worker_salary text) The dot command is deciphered by the sqlite3.exe order line program, not by SQLite itself. As such, a dot command can’t happen at a continuation brief.
Enable the header by using the dot command that means the.To export data into the csv file, we need to follow some steps as follows. Now let’s see how we export the table into the csv file in SQLite as follows.