SlideServe
Menu
Préférences
© SlideServe · v2026

Advanced SQL

afram avatar
10 diapositives · 352 Views · Jul 29, 2014

Microsoft Enterprise Consortium. Advanced SQL. Greenhouse Database – Introduction Saving output in SQL Server Management Studio. Microsoft Enterprise Consortium: http://enterprise.waltoncollege.uark.edu

Advanced SQL - slide 1
01 / 10Advanced SQL
1 / 17

Télécharger la présentation

Advanced SQL
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Microsoft Enterprise Consortium Advanced SQL Greenhouse Database – Introduction Saving output in SQL Server Management Studio Microsoft Enterprise Consortium: http://enterprise.waltoncollege.uark.edu Microsoft Faculty Connection/Faculty Resource Center http://www.facultyresourcecenter.com

  2. What you’ll need … • Log in to MEC for this lesson and into MSSMS (Microsoft SQL Server Management Studio). • Be sure to select your account ID under Database in the Object Explorer pane, similar to the example shown here. • Select the Greenhouse database. (Note: The database name might change over time. Look for MEC_greenhouse or UARK_greenhouse.)

  3. Greenhouse Database • Below is the greenhouse data model. Amend_Code = AmendCode bay_bed CropPlantingID CropPlantingID CropVarID Crop

  4. Greenhouse – SSMS Diagram • SQL Server Management Studio – Diagram • Copy to Clipboard and paste in to a Word file.

  5. Greenhouse Database - How many rows in a table? /* Get a count of the records in each table. */ select count(*) as "tblCrop Rows" from tblCrop; select count(*) as "tblCropVariety Rows" from tblCropVariety; select count(*) as "tblBay_Bed Rows" from tblBay_Bed; select count(*) as "tblCropPlanting Rows" from tblCropPlanting; select count(*) as "tblAmendment Rows" from tblAmendment; select count(*) as "tblCropPlantingAmend Rows" from tblCropPlantingAmend; select count(*) as "tblCropHarvest Rows" from tblCropHarvest;

  6. Greenhouse Database -List contents of small tables. /* List contents of smaller tables. Save output to a file. */

  7. Greenhouse Database – Crops are planted and harvested. Area, Zone, Sector, Bay-Bed Area = “Greenhouse” Zone = “South Seed” Zone = “North Seed” Sector = “A” Bay=“01” Bay=“02” A1 A1 A2 A2 A3 A3 Sector = “B” Bay=“01” B1 B2 B3

  8. Greenhouse Database -View some crop planting data. /* Example SQL: Show how many crops have been planted in bay-bed 01A1. */ select count(*) as "01A1 Crop Count" from tblCropPlanting where bay_bed = '01A1'; /* Show which crops have been planted in bay-bed 01A1. */ select tblCropPlanting.cropVarID, crop, variety, date_planted from tblCropPlanting join tblCropVariety on tblCropPlanting.cropVarID = tblCropVariety.cropVarID where bay_bed = '01A1' order by crop, variety, date_planted;

  9. What was covered … • An overview of the greenhouse database. • How to save SQL output to a file in SQL Server Management Studio.

  10. Resources • http://enterprise.waltoncollege.uark.edu/mec.asp • Microsoft Faculty Connection—Faculty Resource Center http://www.facultyresourcecenter.com/ • Microsoft Transact-SQL Reference • http://msdn.microsoft.com/en-us/library/aa299742(v=SQL.80).aspx • AdventureWorks Sample Database • http://msdn.microsoft.com/en-us/library/ms124659%28v=sql.100%29.aspx