Question

Asked on 2004-08-31 at 06:11:10ID: 25476829

How to set multiple constraints.

by: Celiowin125

Rating7.2Very Good


SID -- A string of four characters in length, student I.D. How could I specify the following constraints:
1) The string has exact four character long,
2) The first character of the string has to be 'S',
3) The other characters have to be numeric.
Can you set it as primary key and unique?

Email -- is an email address, I know how to  hold up to 30 characters but how can u make it contain a '@' character with it as well?

And this what have done so far,
CREATE TABLE Student
(
SID
Name varchar(10) not null,
BirthDate DATE not null,
Email

);

  1. How do I set a foreign key constraint
    I have a table, MyTable. It has two foreign keys that reference the table ValidTable, i.e. MyTable_Major_Code and MyTable_Degc_Code. However the major_code and degc_code in ValidTable, are not unique by themselves, but as a combination key. How do I set the foreign key constraint. Can I set it as follows: ALTER TABLE MyTable a…
  2. Comparing an empty string parameter with a field …
    Hi, Is there any quick way to get rows comparing an empty string parameter with a field that can have null values or not string_parameter := '' ; select * from mytable where ...if string_parameter = '' then... (my_Field is null) ...else .... (my_Field = empty_string_parameter…
  3. How do I find out which columns are involved in …
    If I query the all_constraints table it lists the constraint, but doesn't appear to list which column or columns the constraint involves. How do I find that information?
  4. How do I create a CONSTRAINT on a table COLU…
    I have a table called X2. It contains one COLUMN called FSA_IND I want to create a CONSTRAINT so that FSA_IND can only contain 'Y' or 'N' values. How do I create a CONSTRAINT on a table COLUMN using ALTER TABLE?
  5. Oracle 11g: how to set multiple ORACLE_SIDs?
    Hello Experts, Oracle 11g is heavily dependent on this environmental variable: ORACLE_SID if running multiple dbs, how do I set respective SIDs? do I do: ORACLE_SID ORACLE_SID1 ORACLE_SID2 etc., ? thx experts, regards

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
multiple constraint
Participating Experts
4
Solution Grade
B

Replies

 by: cjjclifford

Posted on 2004-08-31 at 06:37:03ID: 28339046

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: andrewst

Posted on 2004-08-31 at 06:57:38ID: 28339047

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by:

Posted on 2004-08-31 at 07:03:53ID: 28339048

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: grim_toaster

Posted on 2004-08-31 at 07:04:10ID: 28339049

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: mottor

Posted on 2004-08-31 at 07:14:24ID: 28339050

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: cjjclifford

Posted on 2004-08-31 at 07:15:40ID: 28339051

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: andrewst

Posted on 2004-08-31 at 07:21:25ID: 28339052

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: Celiowin

Posted on 2004-08-31 at 07:56:45ID: 28339053

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: grim_toaster

Posted on 2004-08-31 at 08:01:31ID: 28339054

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: Celiowin

Posted on 2004-08-31 at 08:07:22ID: 28339055

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: Celiowin

Posted on 2004-08-31 at 08:17:08ID: 28339056

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: andrewst

Posted on 2004-08-31 at 08:17:38ID: 28339057

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: andrewst

Posted on 2004-08-31 at 08:18:40ID: 28339058

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 by: andrewst

Posted on 2004-08-31 at 08:21:01ID: 28339059

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert