<SQL 2005 or 2008, how do you configure security to allow a user to SELECT data from a table but not view the table definition? I tried GRANT SELECT on both the table and schema, but that also allows viewing table definition. Executing REVOKE VIEW DEFINITION on either the table or the schema does not do it. Below are most usable functions while using SQL.
A database stores data in table (fields and rows). You can communicate with database using SQL and in order to retrieve data (rows) from one or more tables and one or more fields you can use SQL Select statement. A common requirement when working with data, irrespective of its source is to be able to add additional columns to the result set “Ëœon the fly’. this is pretty straightforward if you simply want a new, blank column, just define it directly in the query using the space() function.
sql select statement and sql select statement syntax
The select statement is used in SQL to specify what data you would like returned when querying the MySQL database. An asterisks [*] will return all data, or you can choose specific data. The SQL SELECT statement queries data from tables in the database. The statement begins with the SELECT keyword. The basic SELECT statement has 3 clauses.
SQL Update Statement and SQL Update Syntax
SQL Update is used to update one table columns with specified values. You can update one or multiple columns at the same time. SQL Update syntax which should work in most cases but there are more complicated syntaxes. Remember you can only update one table at a time but you can update multiple fields at the same time by separating them using commas.
Alter table add column and alter table modify column
The ALTER TABLE ADD COLUMN command modifies the definition of an existing table and adds new columns. Only the table owner, a DBA, or a user with the ALTER privilege for that table may execute the command. To specify a column definition, provide a column name and a data type or domain. Optionally add multiple columns in a single command, provided the total number of columns in the table after executing the command does not exceed the maximum number of columns permitted in a table.
The part of an SQL SELECT statement that specifies conditions used to determine which rows are in the query results. Clarify condition in where clause. Condition is evaluated to either TRUE or FALSE. So when you retrieve the data SQL will evaluate condition and it will include only rows where condition is TRUE. The GROUP BY clause can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns.
SQL Update Join and SQL Update
SQL Update the most common task is to specify correct filter (or join) so we update only the rows with values we want to affect. SQL joins are used to query data from two or more tables, based on a relationship between certain columns in the tables.
Check Out also for sql queries interview questions, sql tutorial and sql server interview questions ;