220 likes | 241 Views
Learn how to import data from Excel and create new tables with query instructions in Microsoft SQL Server. Executing queries and managing database elements efficiently.
E N D
Microsoft SQL Server 1. Import Data From Excel Spreadsheet 2. Creating New Table and Query Instruction Consult America Technology Consulting Services
Microsoft SQL Server Microsoft SQL Server: Microsoft SQL Server is a relational database management system developed by Microsoft. As a database server, it is a software product with the primary function of storing and retrieving data as requested by other software applicationswhich may run either on the same computer or on another computer across a network (including the Internet). GUID: Graphics User Interface Development Free Download Microsoft SQL Server 2014 video URL: https://www.youtube.com/watch?v=tNMA41lyq8M&t=17s
Microsoft SQL Server 1. Import Data From Excel Spreadsheet Step by Step: (1) Launch the application (2) Connect EXPORT
Microsoft SQL Server (3) Create new data table ”Employees” (4) Import data table (5) Import step (6) Import step
Microsoft SQL Server (7) Import step (8) Import step (9) Import step (10) Import step
Microsoft SQL Server (11) Import step (12) Import step (13) Import step (14) Import step
Microsoft SQL Server (15) Import step (16) Import successful (17) Refresh (F5) (18) Check data table
Microsoft SQL Server (19) Connect and Execute (20) View imported full table
Microsoft SQL Server (20) For example: • Find out those employees who have commission? SELECT first_name,last_name, salary, commission_pct, salary+salary*commission_pct FROM Employees.dbo.export WHERE commission_pct is not NULL; • Find out the top 10 salaried employees? SELECT first_name,last_name, salary FROM (SELECT first_name, last_name, salary FROM Employees.dbo.export ORDER BY salary DESC) WHERE rownum<=10; • Find out those employees who get more then avg salary? SELECT first_name,last_name, salary FROM Employees.dbo.export WHERE salary>(SELECT AVG(salary) FROM Employees.dbo.export);
Microsoft SQL Server • Find out departments who do not have employees? (SELECT e.first_name,e.last_name,e.department_id, d.department_name FROM employees.dbo.export e, departments d WHERE e.department_id(+)=d.department_id) MINUS (SELECT e.first_name,e.last_name,e.department_id, d.department_name FROM employees.dbo.export e, departments d WHERE e.department_id=d.department_id); • Find out managers of the employees? SELECT e.first_name employee_first_name, e.last_name employee_last_name, m.first_name manager_first_name, m.last_name manager_last_name FROM Employees.dbo.export e, Employees.dbo.export m WHERE m.employee_id=e.manager_id
Microsoft SQL Server 2. Creating New Table and Query Instruction : The following is the creation of "Library management system“ database process Library DB(database)
Microsoft SQL Server Create new folder(database): Library DB Create new file (data table): • dbo.BorrowBook • dbo.Studen • dbo.Book • dbo.Press • dbo. Book Type • dbo.Author
Microsoft SQL Server SQL Data Type : • 1. Binary Data Type (Binary, Varbinary, Image) • 2. Character Data Type (Char, Varcher, Text) • 3. Unicode (Nchar, Nvarchar, Ntext) • 4. Date and Time Date Types (Date Time, Small Date Types) • 5. Digital Data Types (Int, Smallint, Tingint, Decimal, Numeric) • 6. Money Data Types (Money, Small money) • 7. Special Data Types (Time Stamp, Bit, Unique identifier)
Microsoft SQL Server Create student data table: (student data table structure) SQL data table type:
Microsoft SQL Server Create Data table: dbo.BorrowBook dbo.Student dbo.Book
Microsoft SQL Server dbo.Press dbo. Book Type dbo.Author
Microsoft SQL Server 1. Query name is "Mike" student ID, mobile number and e-mail address. 2.Query name is not called "Mike" student ID, mobile and e-mail address.
Microsoft SQL Server 3.Check out between the ages of 20-25 the students ID and names. 4.Discover students who do not fill out the "age" of information. 5. Query name is "Mike", "John", "Bob" of the student ID and age.
Microsoft SQL Server 6. Query which student to borrow books 7. Statistics for each category in the highest price: (using nested queries)
Microsoft SQL Server 8. Query students to borrow books from more than two books: (using nested queries) 9.Export Data Table
Microsoft SQL Server 10. The author of the most books on the query More query.....