Help with ksh shell script

I am using /usr/bin/ksh in AIX

I am reading the values of $dbname, $dbatmpdir/dbdir.$$, and $scope from a different file
All I have to do is check if $dbname exists in file $dbatmpdir/dbdir.$$ and
$scope should have a value either 'TABLE' or 'SCHEMA'.
When I execute the following code. I am getting the below error.

Also please explain about the trick involved in using a single '[' or '[[' with if loop.

if [ `grep $dbname $dbatmpdir/dbdir.$$` && $scope == 'TABLE' || $scope == 'SCHEMA' ]; then
         echo "valid"
         else
         echo "invalid"
         fi

ksh: test: 0403-021 A ] character is missing.
ksh: TABLE: not found.
invalid

Thanks in advance

Your code is giving error because,
1) the correct way to write if is

 if [[ condition ]] 

2)

 `grep $dbname $dbatmpdir/dbdir.$$` && $scope == 'TABLE' 

is becoming one condition...
you should write something like...

 
if [[ ! -z `grep $dbname $dbatmpdir/dbdir.$$` && $scope == 'TABLE' || $scope == 'SCHEMA' ]] 

Thank you rakeshawasthi. Your suggestion worked like champ.

But when to use

if [ condition ]  single '['

and when to use

if [[ condition ]] double '[['

kindly see the below example to show you the correct syntax of if/test in KSH

Example:-

if [[ ($resp==�yes� || $resp==�y�) && -f $1 ]]
then
do_some_commands
fi