Is it possible to store pictures,sounds,videos in SQL Database (or any other database) ? If yes what format should it be and please specifiy about the special settings that has to be configured if any. Thanks in advance.
相关问题
- SQL join to get the cartesian product of 2 columns
- sql execution latency when assign to a variable
- Difference between Types.INTEGER and Types.NULL in
- php PDO::FETCH_ASSOC doesnt detect select after ba
- sqlyog export query result as csv
In MySQL you can store any binary content in a table using the BINARY or VARBINARY data type for a column. Quite all database system as such a data type. It can be used to store a full file content such as picture, video, sound,... or just a binary snippet.
Nevertheless, storing binary files in a database is considered as a bad practice, because it quite always brings to disappointments. Indeed, a file stored in database cannot be easily processed for a download, an inclusion in a HTML page, a streaming, ... . And it is quite always complicated to manipulate because of its length. Most often, a file sorted in a database is disadvantageous compared to a file stored in a directory. Its is advised to store the file name in the database base, and save the actual file in a physical directory.
Although its generally not recommended to store images inside the Database, its better to store path of the image. Nevethless the images can be stored in the database by using a longblob datatype. Check out this example from MySql forums.