i upload my sql ite db to docker image and upload o the linix server and loaded it in dcoker and check with
docker ps
the container work fine
but i need to check data that are in the database
as app.db conatn SIteContent in my local project it was fine but when i upload it in the docker i need to know is ther ant table whtih that name
I use these command
To check if a table exists in an SQLite database, you can use a simple query within the SQLite shell. Here's how to check for the existence of a table:
Step 1: Access the SQLite Database
If you're not already in the SQLite shell, access the database by running:
docker exec -it <container_id_or_name> /bin/bash
sqlite3 /app/Data/app.db
Step 2: List All Tables in the Database
To check if a specific table exists, you can list all the tables in the database using the following command:
.tables
This will display all the tables present in the database. If the SiteContents
table exists, it will appear in the list.
Step 3: Check for a Specific Table
If you want to check whether a specific table exists, you can query the SQLite schema with the following command:
SELECT name FROM sqlite_master WHERE type='table' AND name='SiteContents';
-
If the table
SiteContents
exists, this query will return the nameSiteContents
.
-
If it doesn't exist, the query will return no results.
Step 4: Inspect Table Structure (Optional)
If you want to inspect the structure of a table (e.g., the columns), you can use the .schema
command:
.schema SiteContents
if that dont return tabler name we must create it with this command
CREATE TABLE SiteContents (
Id INTEGER PRIMARY KEY,
Title TEXT,
Text TEXT,
ImageUrl TEXT,
CreateDate TEXT,
ModifyDate TEXT,
Viewed INTEGER,
Publish INTEGER,
Priority INTEGER
);
and for inserting data
INSERT INTO SiteContents (Title, Text, ImageUrl, CreateDate, ModifyDate, Viewed, Publish, Priority)
VALUES ('Discover Our Story',
'<p>At ModifyCompany, our journey began with a simple goal: to create innovative digital solutions that help businesses grow and thrive in a rapidly changing digital world. With a team of passionate professionals, we blend creativity, technology, and strategy to bring your brand’s vision to life. From crafting beautiful designs to developing powerful websites and marketing strategies, we’ve worked with countless businesses to turn their ideas into digital success stories. Join us on our mission to transform the digital landscape—one project at a time.</p>',
'/img/ourStory.png',
'2025-09-24',
'2050-06-24',
1,
1,
1);
now its possible to shceck the data
select * from SiteContent
To list running containers, exit SQLite by typing:
.exit