468,117 Members | 1,453 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,117 developers. It's quick & easy.

Is it possible to store an image, pdf, video, etc. in a SQL database?

38 32bit
Is it possible to store a file (such as an image, pdf file, mp4 video file, etc.) in a SQL database, and then call that file back out of the database to use in web content? If so, how do you do this?
Feb 26 '21 #1

✓ answered by Niheel

Yes. In most SQL databases you can store the images, pdfs and videos directly into the database in their binary format.

To do this you would use a BLOB ( binary large object ) column type to store the file data in.

Example table:
Expand|Select|Wrap|Line Numbers
  1. mysql> create table product ( 
  2. product_id BIGINT PRIMARY KEY,
  3. product_name VARCHAR(50) NOT NULL, 
  4. photo BLOB NOT NULL
  5. ) Engine = InnoDB;
  6.  

1 1587
Niheel
2,418 Expert Mod 2GB
Yes. In most SQL databases you can store the images, pdfs and videos directly into the database in their binary format.

To do this you would use a BLOB ( binary large object ) column type to store the file data in.

Example table:
Expand|Select|Wrap|Line Numbers
  1. mysql> create table product ( 
  2. product_id BIGINT PRIMARY KEY,
  3. product_name VARCHAR(50) NOT NULL, 
  4. photo BLOB NOT NULL
  5. ) Engine = InnoDB;
  6.  
Feb 27 '21 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by den 2005 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.