Stergerea unui tabel

postat acum 4 ani de Stefanescu Mihai in categorie SQL

Comanda SQl DROP TABLE este folosita pentru a sterge un tabel impreuna cu toate datele din el .

Sintaxa de baza a acestei comenzi este urmatoarea:

DROP TABLE numeTabel;

Daca va amintiti din lectia precedenta, am creat tabelul angajati care arata in felul urmator:

DESC angajati;
+---------+---------------+------+-----+---------+-------+
| Field   | Type          | Null | Key | Default | Extra |
+---------+---------------+------+-----+---------+-------+
| ID      | int(11)       | NO   | PRI |         |       |
| Nume    | varchar(20)   | NO   |     |         |       |
| Varsta  | int(11)       | NO   |     |         |       |
| Adresa  | varchar(255)  | YES  |     | NULL    |       |
| Salariu | decimal(18,2) | YES  |     | NULL    |       |
+---------+---------------+------+-----+---------+-------+

Deci, am folosit comanda DESC pentru a vedea ca tabelul angajati inca mai este pe server, iar acum putem da comanda de stergere.

DROP TABLE angajati;

Acum, daca incercam iar sa dam comanda DESC pe tabelul angajati primim urmatoarea eroare:

SQL> DESC angajati;
ERROR 1146 (42S02): Table 'bdTest.angajati' doesn't exist
Sunt un tanar programator din Bucuresti ce lucreaza in PHP/Mysql (MySqli/PDO), Laravel, CodeIgniter, MySQL, PostgreSQL, Wordpress, HTML5/CSS3, Sass, Photoshop si multe altele.
Google+ Community Facebook Group
Acest articol a fost mutat de pe vechea platforma.
Pentru orice eroare aparuta la mutare va rog sa ma contactati!

Comentariu postate de free minecraft download la data de 16.05.2019
Do you mind if I quote a few of your posts as long as I provide credit and sources back to your website? My website is in the exact same niche as yours and my visitors would really benefit from some of the information you present here. Please let me know if this okay with you. Thanks a lot!
Comentariu postate de minecraft pc download la data de 16.05.2019
You made some really good points there. I looked on the web for more information about the issue and found most people will go along with your views on this site.