| لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL | |
|
|
كاتب الموضوع | رسالة |
---|
Face Off عضو مميز
عدد الرسائل : 70 تاريخ التسجيل : 29/10/2008
| موضوع: لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL الجمعة نوفمبر 21, 2008 9:00 am | |
| SQL Intro An introduction to SQL. SQL SELECT How the SELECT statement is used to select data from a database. SQL WHERE How the WHERE clause is used to conditionally select data. SQL INSERT INTO How the INSERT INTO statement inserts new records (rows) into a database table. SQL UPDATE How to modify data in a database using the UPDATE statement. SQL DELETE How to delete records (rows) in a database, using the DELETE statement. SQL Advanced SQL ORDER BY The ORDER BY keyword is used to sort the result. SQL AND & OR AND and OR join two or more conditions in a WHERE clause. SQL IN The IN operator may be used if you know the exact value(s) to search for. SQL BETWEEN The BETWEEN operator selects a range of data between two values. SQL ALIAS Aliases can be used for column names and table names. SQL JOIN How to use the JOIN operator to select data from two or more tables. SQL UNION The UNION operator is used to select related information from two tables. SQL CREATE How to create a new database and / or a new database table. SQL DROP How to drop (delete) a database and /or a database table. SQL ALTER How to user ALTER to add or delete table columns. SQL Functions SQL has a lot of built-in functions for counting and calculations. SQL GROUP BY How to use GROUP BY to group aggregated data. SQL SELECT INTO How to use SELECT INTO to save selected data in tables (create backup copies). SQL CREATE VIEW How to create a virtual table using CREATE VIEW. SQL Server About Database Management Systems (DBMS). SQL Quick Reference An SQL Quick Reference. Print it, fold it, and put it in your pocket. SQL Summary A summary of this tutorial. SQL Quiz Test Start SQL quiz! Test your SQL skills at W3Schools!
SQL Functions SQL AVG Function The AVG function returns the average value of a column in a selection. NULL values are not included in the calculation. Syntax SELECT AVG(column) FROM table Example This example returns the average age of the persons in the "Persons" table: SELECT AVG(Age) FROM Persons Result 32.67 Example This example returns the average age for persons that are older than 20 years: SELECT AVG(Age) FROM Persons WHERE Age>20 Result 39.5
SQL COUNT Function The COUNT(column) function returns the number of rows without a NULL value in the specified column. Syntax SELECT COUNT(column) FROM table Example With this "Persons" Table: Name Age Hansen, Ola 34 Svendson, Tove 45 Pettersen, Kari This example finds the number of persons with a value in the "Age" field in the "Persons" table: SELECT COUNT(Age) FROM Persons Result: 2 The COUNT(column) function is handy for finding columns without a value. Note that the result is one less than the number of rows in the original table because one of the persons does not have an age value stored. SQL COUNT(*) Function The COUNT(*) function returns the number of selected rows in a selection. Syntax SELECT COUNT(*) FROM table Example With this "Persons" Table: Name Age Hansen, Ola 34 Svendson, Tove 45 Pettersen, Kari 19 This example returns the number of rows in the table: SELECT COUNT(*) FROM Persons Result: 3 Example Return the number of persons that are older than 20 years: SELECT COUNT(*) FROM Persons WHERE Age>20 Result: 2
SQL MAX Function The MAX function returns the highest value in a column. NULL values are not included in the calculation. Syntax SELECT MAX(column) FROM table Example SELECT MAX(Age) FROM Persons Result: 45 Note: The MIN and MAX functions can also be used on text columns, to find the highest or lowest value in alphabetical order. SQL MIN Function The MIN function returns the lowest value in a column. NULL values are not included in the calculation. Syntax SELECT MIN(column) FROM table Example SELECT MIN(Age) FROM Persons Result: 19 Note: The MIN and MAX functions can also be used on text columns, to find the highest or lowest value in alphabetical order. SQL SUM Function The SUM function returns the total sum of a column in a given selection. NULL values are not included in the calculation. Syntax SELECT SUM(column) FROM table Example This example returns the sum of all ages in the "person" table: SELECT SUM(Age) FROM Persons Result: 98 Example This example returns the sum of ages for persons that are more than 20 years old: SELECT SUM(Age) FROM Persons WHERE Age>20 Result: 79
SQL AVG Function The AVG function returns the average value of a column in a selection. NULL values are not included in the calculation. Syntax SELECT AVG(column) FROM table Example This example returns the average age of the persons in the "Persons" table: SELECT AVG(Age) FROM Persons Result 32.67 Example This example returns the average age for persons that are older than 20 years: SELECT AVG(Age) FROM Persons WHERE Age>20 Result 39.5
SQL COUNT Function The COUNT(column) function returns the number of rows without a NULL value in the specified column. Syntax SELECT COUNT(column) FROM table Example With this "Persons" Table: Name Age Hansen, Ola 34 Svendson, Tove 45 Pettersen, Kari This example finds the number of persons with a value in the "Age" field in the "Persons" table: SELECT COUNT(Age) FROM Persons Result: 2 The COUNT(column) function is handy for finding columns without a value. Note that the result is one less than the number of rows in the original table because one of the persons does not have an age value stored. SQL COUNT DISTINCT Function Note: The following example works with ORACLE and Microsoft SQL server but not with Microsoft Access. The keyword DISTINCT and COUNT can be used together to count the number of distinct results. Syntax SELECT COUNT(DISTINCT column(s)) FROM table Example With this "Orders" Table: Company OrderNumber Sega 3412 W3Schools 2312 Trio 4678 W3Schools 6798 Example SELECT COUNT(Company) FROM Orders Result: 4 Example SELECT COUNT(DISTINCT Company) FROM Orders Result: 3
SQL FIRST Function The FIRST function returns the value of the first record in the specified field. Tip: Use the ORDER BY clause to order the records! Syntax SELECT FIRST(column) AS [expression] FROM table Example SELECT FIRST(Age) AS lowest_age FROM Persons ORDER BY Age Result: 19
SQL LAST Function The LAST function returns the value of the last record in the specified field. Tip: Use the ORDER BY clause to order the records! Syntax SELECT LAST(column) AS [expression] FROM table Example SELECT LAST(Age) AS highest_age FROM Persons ORDER BY Age Result: 45
SQL MAX Function The MAX function returns the highest value in a column. NULL values are not included in the calculation. Syntax SELECT MAX(column) FROM table Example SELECT MAX(Age) FROM Persons Result: 45 Note: The MIN and MAX functions can also be used on text columns, to find the highest or lowest value in alphabetical order.
SQL MIN Function The MIN function returns the lowest value in a column. NULL values are not included in the calculation. Syntax SELECT MIN(column) FROM table Example SELECT MIN(Age) FROM Persons Result: 19 Note: The MIN and MAX functions can also be used on text columns, to find the highest or lowest value in alphabetical order.
SQL SUM Function The SUM function returns the total sum of a column in a given selection. NULL values are not included in the calculation. Syntax SELECT SUM(column) FROM table Example This example returns the sum of all ages in the "person" table: SELECT SUM(Age) FROM Persons Result: 98 Example This example returns the sum of ages for persons that are more than 20 years old: SELECT SUM(Age) FROM Persons WHERE Age>20 Result: 79
[code] | |
|
| |
lolitaaaaa مشرف
عدد الرسائل : 48 العمر : 33 تاريخ التسجيل : 17/11/2008
| موضوع: رد: لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL الجمعة نوفمبر 21, 2008 6:21 pm | |
| مع انى مش فاهمه اى حاجه من الكلام ده بس ميرسى اوى على مجهودك الرائع يا قمر | |
|
| |
The MasTer المدير
عدد الرسائل : 486 العمر : 37 مزاجي : 0 تاريخ التسجيل : 10/08/2008
| موضوع: رد: لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL الأحد نوفمبر 23, 2008 11:09 pm | |
| مشكووووووووووور كتير اخ فاس على عملك قيم وربنا يوفقك | |
|
| |
أسيرة الأحزان مشرف
عدد الرسائل : 499 العمر : 33 تاريخ التسجيل : 17/09/2008
| موضوع: رد: لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL الإثنين نوفمبر 24, 2008 6:58 am | |
| | |
|
| |
shika22 عضو مميز
عدد الرسائل : 268 العمر : 32 مزاجي : 0 تاريخ التسجيل : 14/08/2008
| |
| |
shika22 عضو مميز
عدد الرسائل : 268 العمر : 32 مزاجي : 0 تاريخ التسجيل : 14/08/2008
| |
| |
lolitaaaaa مشرف
عدد الرسائل : 48 العمر : 33 تاريخ التسجيل : 17/11/2008
| موضوع: رد: لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL الثلاثاء نوفمبر 25, 2008 6:27 am | |
| معلش يا جماعه اصل فيس تعليمه مش مصرى متعلم فى الجامعه السوسريه الكنديه الامريكيه الهنديه القطريه اللى تحت بيتهم | |
|
| |
The MasTer المدير
عدد الرسائل : 486 العمر : 37 مزاجي : 0 تاريخ التسجيل : 10/08/2008
| موضوع: رد: لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL الأربعاء نوفمبر 26, 2008 12:40 pm | |
| هههههههههههههههههههههههههههه وربنا دمك عسل لولة منور اخ فييييييس | |
|
| |
shika22 عضو مميز
عدد الرسائل : 268 العمر : 32 مزاجي : 0 تاريخ التسجيل : 14/08/2008
| |
| |
Face Off عضو مميز
عدد الرسائل : 70 تاريخ التسجيل : 29/10/2008
| موضوع: رد: لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL الجمعة نوفمبر 28, 2008 6:21 pm | |
| ميرسى كتير على التريقة الجميلة دى بس دى لغة بيتم عمل بها البرامج الحسابيية وقواعد البيانات وانشاء صفحات الانترنت وطبعا محدش بردة فاهم حاجة | |
|
| |
shika22 عضو مميز
عدد الرسائل : 268 العمر : 32 مزاجي : 0 تاريخ التسجيل : 14/08/2008
| |
| |
اميرة الرومانسية نائب مدير
عدد الرسائل : 1434 العمر : 32 مزاجي : 0 تاريخ التسجيل : 11/08/2008
| موضوع: رد: لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL الثلاثاء ديسمبر 02, 2008 7:55 pm | |
| ههههههههههههههههه اه منك يالوله
مشكور ياقمر ربنا يوفقك ياجميل | |
|
| |
| لكل من يستعمل برنامج SQL او يستخدم جمل ال SQL | |
|