Get full details of all departments using * : Select « Select Query « SQL Server / T-SQL






Get full details of all departments using *

1>
2> CREATE TABLE department(dept_no   CHAR(4) NOT NULL,
3>                         dept_name CHAR(25) NOT NULL,
4>                         location  CHAR(30) NULL)
5>
6> insert into department values ('d1', 'developer',   'Dallas')
7> insert into department values ('d2', 'tester',      'Seattle')
8> insert into department values ('d3', 'marketing',  'Dallas')
9>
10>
11>
12>
13> -- Get full details of all departments.
14>
15> SELECT * from department
16> GO

(1 rows affected)

(1 rows affected)

(1 rows affected)
dept_no dept_name                 location
------- ------------------------- ------------------------------
d1      developer                 Dallas
d2      tester                    Seattle
d3      marketing                 Dallas

(3 rows affected)
1>
2> drop table department
3> GO

           
       








Related examples in the same category

1.Use regular expressions to retrieve table data
2.Sorting Results
3.Using Functions in Queries
4.Using TOP in select statement
5.Select a single row
6.Group by, having and order
7.Use your function in select statement
8.Using the CASE Statement
9.Queries Involving Null Values
10.SELECT: return literal values that are just part of an expression
11.An expression-type result set can be aliased and treated as if it were a table
12.Select with 'Case when'