If you have a database backup .bak file extension and want to restore it using SQL query. You can use the built-in 'RESTORE DATABASE' function. Remember in order to be able to restore a database successfully. You need to be a database owner which has the role of db_owner. You also need to ensure that there is no open session use the database.