SQL: Delete Vs Truncate Vs Drop

Поделиться
HTML-код
  • Опубликовано: 27 окт 2015
  • In this tutorial, you'll learn the difference between delete/drop and truncate.
    PL/SQL (Procedural Language/Structured Query Language) is Oracle Corporation's procedural extension for SQL and the Oracle relational database. PL/SQL is available in Oracle Database (since version 7), TimesTen in-memory database (since version 11.2.1), and IBM DB2 (since version 9.7).[1] Oracle Corporation usually extends PL/SQL functionality with each successive release of the Oracle Database.
    PL/SQL includes procedural language elements such as conditions and loops. It allows declaration of constants and variables, procedures and functions, types and variables of those types, and triggers. It can handle exceptions (runtime errors). Arrays are supported involving the use of PL/SQL collections. Implementations from version 8 of Oracle Database onwards have included features associated with object-orientation. One can create PL/SQL units such as procedures, functions, packages, types, and triggers, which are stored in the database for reuse by applications that use any of the Oracle Database programmatic interfaces.
    PL/SQL works analogously to the embedded procedural languages associated with other relational databases. For example, Sybase ASE and Microsoft SQL Server have Transact-SQL, PostgreSQL has PL/pgSQL (which emulates PL/SQL to an extent), and IBM DB2 includes SQL Procedural Language,[2] which conforms to the ISO SQL’s SQL/PSM standard.
    The designers of PL/SQL modeled its syntax on that of Ada. Both Ada and PL/SQL have Pascal as a common ancestor, and so PL/SQL also resembles Pascal in several aspects. However, the structure of a PL/SQL package does not resemble the basic Object Pascal program structure as implemented by a Borland Delphi or Free Pascal unit. Programmers can define public and private global data-types, constants and static variables in a PL/SQL package.[3]
    PL/SQL also allows for the definition of classes and instantiating these as objects in PL/SQL code. This resembles usage in object-oriented programming languages like Object Pascal, C++ and Java. PL/SQL refers to a class as an "Abstract Data Type" (ADT) or "User Defined Type" (UDT), and defines it as an Oracle SQL data-type as opposed to a PL/SQL user-defined type, allowing its use in both the Oracle SQL Engine and the Oracle PL/SQL engine. The constructor and methods of an Abstract Data Type are written in PL/SQL. The resulting Abstract Data Type can operate as an object class in PL/SQL. Such objects can also persist as column values in Oracle database tables.
    PL/SQL is fundamentally distinct from Transact-SQL, despite superficial similarities. Porting code from one to the other usually involves non-trivial work, not only due to the differences in the feature sets of the two languages,[4] but also due to the very significant differences in the way Oracle and SQL Server deal with concurrency and locking. There are software tools available that claim to facilitate porting including Oracle Translation Scratch Editor,[5] CEITON MSSQL/Oracle Compiler [6] and SwisSQL.[7]
    The StepSqlite product is a PL/SQL compiler for the popular small database SQLite.
    PL/SQL Program Unit
    A PL/SQL program unit is one of the following: PL/SQL anonymous block, procedure, function, package specification, package body, trigger, type specification, type body, library. Program units are the PL/SQL source code that is compiled, developed and ultimately executed on the database.
    The basic unit of a PL/SQL source program is the block, which groups together related declarations and statements. A PL/SQL block is defined by the keywords DECLARE, BEGIN, EXCEPTION, and END. These keywords divide the block into a declarative part, an executable part, and an exception-handling part. The declaration section is optional and may be used to define and initialize constants and variables. If a variable is not initialized then it defaults to NULL value. The optional exception-handling part is used to handle run time errors. Only the executable part is required. A block can have a label.
    Package
    Packages are groups of conceptually linked functions, procedures, variables, PL/SQL table and record TYPE statements, constants, cursors etc. The use of packages promotes re-use of code. Packages are composed of the package specification and an optional package body. The specification is the interface to the application; it declares the types, variables, constants, exceptions, cursors, and subprograms available. The body fully defines cursors and subprograms, and so implements the specification. Two advantages of packages are:
    Modular approach, encapsulation/hiding of business logic, security, performance improvement, re-usability. They support object-oriented programming features like function overloading and encapsulation.
    Using package variables one can declare session level (scoped) variables, since variables declared in the package specification have a session scope.
  • НаукаНаука

Комментарии • 55

  • @AkashJaiswalAkash7771
    @AkashJaiswalAkash7771 8 лет назад +36

    More Details :-
    Delete command first check the where condition , get the satisfied tuple..check the triggers .. and then Copy it in the Roll-back table Space (Eqivalent to recyclebin ) and then . delete the rows ..
    truncate directly delete the data..
    That is why Delete is slower then truncate..
    Also Delete is a DML Command so it can be roll-backed because [ Transaction Control (TCL): statements are used to manage the changes made by DML statements ]
    truncate and drop are DDL commands , cannot use TCL commands on them .
    We can use flashback table statement to retrieve the content back..from recyclebin table

  • @vallurusudeep5789
    @vallurusudeep5789 8 лет назад +1

    I am a beginner ,your videos are short, sweet and exactly what I'm looking for, thank you!

  • @harishks3020
    @harishks3020 7 лет назад +2

    Covered delete, truncate, drop, commit & rollback concepts. Really Good one. Thank you.

  • @vandanaludhani7237
    @vandanaludhani7237 6 лет назад +1

    nice explanation. i learnt many small but imp things in SQL AND PL/ SQL from yu. THANKS

  • @kalyanch7548
    @kalyanch7548 7 лет назад +1

    Easy to understand and very good explication...Simply superb..

  • @rishabhjain1056
    @rishabhjain1056 7 лет назад +1

    Nice vdeo, I always got confused between the three.. it has optimal details not more or less.. Good one.

  • @pavankakarla1898
    @pavankakarla1898 6 лет назад +4

    lot of love and respect..!!!!

  • @amar20073
    @amar20073 8 лет назад +1

    Nicely explained!!!

  • @gloriabukachi1
    @gloriabukachi1 5 лет назад +1

    Great tutorial, thank you

  • @codestorywithMIK
    @codestorywithMIK 6 лет назад +1

    Very well explained and elaborated. Thanks a lot..

  • @kuldeepsingh-lp1dr
    @kuldeepsingh-lp1dr 5 лет назад +1

    Loved the content😊....thank you ma'am.

  • @ramakrishnabhuma5037
    @ramakrishnabhuma5037 7 лет назад +2

    Good job!

  • @sanjeebamat2608
    @sanjeebamat2608 6 лет назад +1

    nice explanation !!!

  • @palnadustyles132
    @palnadustyles132 7 лет назад +1

    very good explanation radhika,keep it up

  • @mohitverma-zl5iw
    @mohitverma-zl5iw 6 лет назад +2

    This is very helpful mam thanks a lot.

  • @shamrajput8058
    @shamrajput8058 7 лет назад +1

    Nice Mam.................very helpfull................................

  • @nagarbaul420
    @nagarbaul420 7 лет назад +2

    Thanks for your video, in my last interview, I was asked about isolation level. Can you do a video on that? Thanks again

  • @chaitanyao.v.s7954
    @chaitanyao.v.s7954 7 лет назад +2

    nice explanation mam,thank u

  • @sagarpahuja357
    @sagarpahuja357 7 лет назад +1

    Maam could you please give me the link of that software...that version oracle 12c is not working in my laptop

  • @srinivasan6139
    @srinivasan6139 8 лет назад +1

    nice explanation

  • @vinitrana1718
    @vinitrana1718 8 лет назад +2

    easy to understand

  • @rupalihajare8306
    @rupalihajare8306 5 лет назад

    Very easy explanation

  • @blanka4545
    @blanka4545 7 лет назад +2

    great explanation loved it! :)

  • @creativelife35
    @creativelife35 6 лет назад +1

    thanks mam very useful

  • @balakrishnamokashi4732
    @balakrishnamokashi4732 6 лет назад +1

    is 'rollback' works after drop table?

  • @chennareddymitta3883
    @chennareddymitta3883 6 лет назад +1

    Mam please tell me when I truncate the whole table ?Can I get the table back again from the database

  • @shivraj7078
    @shivraj7078 5 лет назад

    Good one

  • @sushantkumar9785
    @sushantkumar9785 6 лет назад

    superb and thanku

  • @sonalishelar4242
    @sonalishelar4242 5 лет назад +1

    Easily understand 😄

  • @sureshkesari8210
    @sureshkesari8210 7 лет назад +1

    tqu mam ,

  • @anandchaudhary6219
    @anandchaudhary6219 5 лет назад +1

    Nice

  • @sonalishelar4242
    @sonalishelar4242 5 лет назад +1

    In wamp there is MySQL Console..rollback cmd is not work..

  • @bsailaja9703
    @bsailaja9703 6 лет назад +1

    nice yaar

  • @lakshmireddy9952
    @lakshmireddy9952 5 лет назад +1

    WEll done

  • @prashanthmysore4223
    @prashanthmysore4223 7 лет назад +1

    Hey Radhika good one, please be confident while delivering and volume should be bit high.
    thank you.

  • @atulbaghresh4877
    @atulbaghresh4877 5 лет назад

    Thanku mam ☺

  • @abbasmastan3
    @abbasmastan3 6 лет назад +1

    Good

  • @gopalmalupula3228
    @gopalmalupula3228 5 лет назад

    Is it possible return drop the table

  • @akhtarabbas5760
    @akhtarabbas5760 6 лет назад +1

    just wow

  • @dsbs-ke1yn
    @dsbs-ke1yn 5 лет назад

    Hi can you share how create index video

  • @--Mr.Bombastic--
    @--Mr.Bombastic-- 6 лет назад +1

    good

  • @gopalmalupula3228
    @gopalmalupula3228 5 лет назад +2

    Return drop the table.
    Flashback table tablename to before drop.

  • @AKhan-nu9mw
    @AKhan-nu9mw 8 лет назад

    Thanx u very much

  • @praveennagarajan2921
    @praveennagarajan2921 2 месяца назад

    Mam can you suggest me a book for SQL ?

  • @krazyvasu180
    @krazyvasu180 8 лет назад +3

    Very nyc with required time taking , not less, not more....by the way what is "TRIGER"

  • @mihirjapanese3278
    @mihirjapanese3278 8 лет назад +1

    which is faster truncate or drop?

    • @rishabhjain1056
      @rishabhjain1056 7 лет назад

      Did you find this answer? Even I would like to know the answer.

  • @cheekatirajesh7410
    @cheekatirajesh7410 Месяц назад

    How to delete default tables system tables

  • @ibrahimxakkie6420
    @ibrahimxakkie6420 6 лет назад +2

    lecturer is very nice but please in starting portion ...their is enough and their is lot of thing u tell. so please trim all this

  • @cheekatirajesh7410
    @cheekatirajesh7410 Месяц назад

    How to delete all tables

  • @pashatyulnev8603
    @pashatyulnev8603 6 лет назад

    only people from india write that its easy to understand xD

  • @annakozin6446
    @annakozin6446 6 лет назад +1

    Thanks a lot! But PLEASE make an effort to speak in english!

  • @DanielNistrean
    @DanielNistrean 8 лет назад +3

    Very hard to understand language.

  • @edsharen1709
    @edsharen1709 5 лет назад

    Good