1 / 25

MY SQL

MY SQL. Eng: SAHAR. Introduction to SQL. What is SQL? When a user wants to get some information from a database file, he can issue a query A query is a user–request to retrieve data or information with a certain condition

creola
Download Presentation

MY SQL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MY SQL Eng: SAHAR

  2. Introduction to SQL What is SQL? • When a user wants to get some information from a database file, he can issue a query • A query is a user–request to retrieve data or information with a certain condition • SQL is a query language that allows user to specify the conditions. (instead of algorithms )

  3. LanguageSQL • Data Multiplication Language ( DML) لغة معالجة البيانات • Data Definition Language (DDL) لغة تعريف البيانات

  4. Data Multiplication Language ( DML) • Select • Insert • Update • Delete

  5. Select Statement • SELECT Field Name FROM Table Name EX: We have This Table With the name MyTable And we need to select ID Field

  6. Solution • SelectId From MyTable Result:

  7. EX: We have This Table With the name MyTableAnd we need to select ID ,Name Fields • SelectId, Name From MyTable Result:

  8. To Select all table Fields • Select * From Table Name We Use * instead of write of all Fields

  9. Then If We Apply This For above Example Solution will be: Select * From MyTable

  10. Where … • If We Have a condition in using Select we can use where • Select Field name From Table Name Where Condition

  11. Where Conditions

  12. EX: From Above Table Select All data about Ali Solution Select * From MyTable Where Name =“ Ali”

  13. INSERTStatement • Insert into Table name (Fields name) Values ( Field values) • Ex : Insert Into MyTable (ID, Name, Address, Note) Values (4,’Kindy’,’Cairo’,’SQL’)

  14. The Result will be :

  15. Delete Statement • Delete From Table Name Where Condition • EX: Delete Form MyTable Where Name=‘Kindy’

  16. The Result will be :

  17. UpDateStatement • UpDate Table name Set Field Name = values Ex : Up date MyTable set Yomna instead of Basma Solution Update MyTable SetName = ‘Yomna’ Where Name=‘Basma’

  18. Data Definition Language ( DDL) • CREATE • ALTER • DROP • RENAME

  19. Create Statement • Create Table Table Name <Field name> <Field Type > • Field Type ….. Char(X) VarChar(X) Integer Date

  20. EX: Create Table MyTable (ID Integer, Name Varchar(15),Address Varchar(15),Note Varchar(50))

  21. Alter Statement • Alter Table Table Name Add <Field name> <Field Type >

  22. EX: Alter Table MyTable Add Date date

  23. Rename Statement • Alter Table Table Name Rename to New Name • EX: Alter Table MyTable Rename To Sales

  24. Drop Statement • Drop Table Table Name • EX: Drop Table MyTable

More Related